Hi Henrik,
Il 12.48 20/05/2002 Henrik Nordstrom ha scritto:
>On Monday 20 May 2002 11:46, Guido Serassio wrote:
>
> > I have added this without looking how memPoolAlloc works after some
> > problems during debug session on MS VisualStudio, because in debug
> > mode sometimes the memory after a malloc is not clean.
> >
> > For example in store_dir_coss.c, line 750:
> >
> > cs = xmalloc(sizeof(CossInfo));
> > if (cs == NULL)
> > fatal("storeCossDirParse: couldn't xmalloc()
> > CossInfo!\n");
> >
> > Debugging I had problems with some not initialized members of cs.
>
>xmalloc do not clear the memmory. xcalloc does..
Yes, I know, but when debugging an unknown code, problem like this are very
tedious.
>Most likely the CossInfo should be pooled.
So, If I understand right MemPools docs, it should be something like:
storeFsSetup_coss():
coss_info_pool = memPoolCreate("COSS info data", sizeof(CossInfo));
storeCossDirParse():
cs = memPoolAlloc(coss_info_pool);
storeCossDirShutdown():
memPoolFree(coss_info_pool, cs);
(now the free of memory is missing)
storeCossDirDone():
memPoolDestroy(&coss_info_pool);
Regards
Guido
>Regards
>Henrik
-
=======================================================
Serassio Guido
Via Albenga, 11/4 10134 - Torino - ITALY
E-mail: guido.serassio@serassio.it
WWW: http://www.serassio.it
Received on Mon May 20 2002 - 14:23:18 MDT
This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 16:15:29 MST