[Gc] how to get the gc allocated bytes?

Boehm, Hans hans.boehm at hp.com
Mon Dec 3 10:19:48 PST 2007

Probably your best bet is to run a program that just calls GC_gcollect a couple of times with the GC_PRINT_STATS or GC_PRINT_VERBOSE_STATS environment variable set.  For gc7, this will print the amount of live memory found in the heap.  This might include some blacklisted pages as atomic reachable memory, though probably not if you don't allocate anything.

In general, the collector allocates a few, usually small, data structures in its own heap.  I wouldn't expect these to be terribly significant unless you have an almost empty heap, you have a very large number of threads, or there are a high proportion of finalizable objects or "disappearing links".

The heap is grown in much larger, though initially not huge, increments.  And the collector explicitly expands the heap to its initial size at startup.


> -----Original Message-----
> From: gc-bounces at napali.hpl.hp.com
> [mailto:gc-bounces at napali.hpl.hp.com] On Behalf Of Achilleas
> Margaritis
> Sent: Sunday, December 02, 2007 1:09 PM
> To: gc at napali.hpl.hp.com
> Subject: [Gc] how to get the gc allocated bytes?
> I call GC_gcollect() and then I call GC_get_heap_size(), but
> the result is not 0. How can I know how many bytes are
> allocated by the collector?
> _______________________________________________
> Gc mailing list
> Gc at linux.hpl.hp.com
> https://www.hpl.hp.com/hosted/linux/mail-archives/gc/

More information about the Gc mailing list