[Gc] Collecting large memory blocks

Christian Gudrian christian at gudrian.org
Wed Dec 2 05:23:51 PST 2009


Hello!

I am using the most recent CVS version of the collector under Win32
compiled with C++Builder6.

I wrote a simple test program to verify the operation of the collector
under different conditions.  During the tests I constantly monitor the
values of GC_get_heap_size() and GC_get_free_bytes() to judge if certain
memory blocks which became unreachable got collected.  This of course
involves manually calling GC_gcollect() to force a collection cycle.

I discovered that large memory blocks do not get reclaimed once they
become unreachable.  For example:

GC_MALLOC(100000)  -> gets collected during the next cycle
                         (GC_get_free_bytes() increases accordingly)
GC_MALLOC(1000000) -> never gets collected
                         (GC_get_free_bytes() does not increase)

Apart from the amount of memory allocated both calls take place under the
same conditions.

Is this behaviour intended, and if so: why?

Christian Gudrian


More information about the Gc mailing list