[Gc] Re: how to get the gc allocated bytes?

Achilleas Margaritis axilmar at otenet.gr
Fri Dec 7 02:38:38 PST 2007

O/H Boehm, Hans έγραψε:
> 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.
> Hans
>> -----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/

But I still do not know how to get the number of bytes allocated by the 
gc. I don't want to print statistics, I want to know programmatically 
how many bytes are allocated at each point in time.

I've got to write a new version of a commercial application and I would 
like to use the collector, but the customer insists that I track memory 
allocation precisely (hint: the contract is for the military, and there 
are some very strict requirements).

More information about the Gc mailing list