[Gc] Memory leak without GC_collect()

Christophe Meessen meessen at cppm.in2p3.fr
Fri Apr 25 23:19:13 PDT 2008


I finally found something in the client since I can switch the leaking 
on and off by switching the finalizer call on and off..

I have two classes taking care of the input and output data encoding. 
These classes have some std::vector, std::deque et std::map as
member variable. There is a leak when these class instances are not 
destructed which is the case when my classes inherits from gc and not 
gc_cleanup.
When my class derives from gc_cleanup there is no leak ... in the client.

So I suspect the problem is related to STL containers since my class has 
just some unsigned short int member variables and  a few pointers into 
some buffer I  allocated with GC_MALLOC_ATOMIC.

When using these classes instances as local function variables their 
destructor is called when the variable gets out of scope. When used as 
member variable of a class derived from gc, their destructor is not called.

Note that this is all on Linux. I didn't check with  VC++2003 yet, and I 
still have a persistant leak with my server, even if all classes derive 
from gc_cleanup.



More information about the Gc mailing list