Re: [gtk-list] Re: how can I trust glib when it has so manymemleaks?



Lars Hallberg wrote:
> 
> Making a function that frees all glib memory might be good for
> automated testing that simply veryfy 0 leak on many, many programs.
> I'm not sure it is worth the effort...

In order to make my program one of those many with 0 leak, I need a
testing tool.

> If You test manaly, it is sufficient to compare what Your tool
> report leeking with what g_mem_profile() reports delebaritly
> leavs for the OS to free. If the amount maches Your code leaks
> nothing.

The problem is this: to be able to report the same ammount of memory, I
was forced to create all objects dynamically (in my C++ program). With
new. And delete them before calling g_mem_profile. Also, ccmalloc
reports all memory as garbage when my program is linked with patched
glib (aka with g_mem_profile that reports soemthing). 

If my objects are static, they are destroyed when the main is finished.
The report of g_mem_profile will have no relevance in that case.

> Well, Youre code might leek memory allocated thru glib but that
> will showe up as suspisiusly big figures on the g_mem_profile().
> 
> Possably g_mem_profile() can differntiate between memmory that is
> allocated but 'free' or internaly used an memory allocated by
> the users code? If not, that is probably the right spot to hack
> glib..... Best luck ;-)

See above. g_mem_profile can't handle all the cases. A function like
free all glib memory would be the best thing. 

Ionutz



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]