[Gc] Memory leak without GC_collect()
meessen at cppm.in2p3.fr
Fri Apr 25 13:22:05 PDT 2008
thanks for helping. It is a really tricky bug. As suggested I changed
all gc_cleanup to gc by using the following instruction just after
#define gc_cleanup gc
I hope it is Ok for a hack. Now assuming there can't be finalizer
cycles, I now see a slower but steady memory leak with the client
(3MB/s) and a ten times faster leak with the server (30MB/s). It can't
be missed. I also notice that adding GC_collect() has no effect anymore
with the server when using gc_cleanup.
So I assume the cause of the problem must be different. The factor ten
difference can't be explained from the code. They should both have a
similar instance creation rate.
The client and server are both a loop instantiating the objects required
to communicate and referenced by local variables inside the loop.
The communication part of the code is the same in the client and the
server. The difference is with the service object. It has a static
vector of method pointers. There is no such vector in the client, so the
steady memory leak there must have another origin.
Another thing is that all my classes are derived from gc/gc_cleanup and
I always use new to instantiate objects. Could this be the problem ?
Regarding the version, I saw Hans Boehm recommending using the latest
version of the code if something didn't work properly. Beside, it helps
for finding bugs in libgc.
More information about the Gc