[Gc] Heap not emptying?

Mike Hearn mike at plan99.net
Fri Aug 11 16:32:08 PDT 2006


Hi,

I am experimenting with using GC in C++. I have a program that allocates
an object which in turn allocates some more objects, and the first object
is stored in a global static variable.

The collector *is* working because I have a loop that does a bunch of
calculations that result in heap allocations, and they are tidied up
correctly.

However, even if I set the global variable that roots the whole thing to
NULL and force a collect, there are still a few heap cells in use
according to GC_dump(). Seems no matter what I do, the collector won't
empty the heap completely.

Is this some kind of heuristic that is just ignoring the last 24k of heap
or something because it's so small, or am I doing something wrong
somewhere?

I have checked for possible references to the object elsewhere and
didn't find any (and this is a very small piece of code) so I am 99% sure
it should be collectable.

thanks -mike



More information about the Gc mailing list