[Gc] dynamic structures and gc

Mark Richards mark.richards at massmicro.com
Fri Sep 2 13:03:51 PDT 2011


On 9/2/2011 15:26, Ivan Maidanski wrote:
> Hi Mark,
>
> To my understanding, you should measure (GC_get_heap_size() - GC_get_free_bytes()) instead of GC_get_heap_size().
If it helps, here's what is being reported by the gc memory logging 
functions:

Before allocation:

     Heap size = 0
     Free bytes= 0
     bytes since gc= 0
     total bytes = 0
     GC collect status=0    //printf("GC collect status=%i\n",GC_dont_gc);

After freeing and just before exit:

     Heap size = 479232
     Free bytes= 32768
     bytes since gc= 331844
     total bytes = 331844
     GC collect status=0    //printf("GC collect status=%i\n",GC_dont_gc);


I put some testing in the allocation loop and I can see heap size 
increase.  The same tests in the free loop do not decrement at all.

Note I tested GC_dont_gc to make sure it's on.

Tried this with GC_init() present or absent at start of code.  Same 
thing.  What seems also strange is that free bytes are 0 at start.

/m
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://napali.hpl.hp.com/pipermail/gc/attachments/20110902/1284157e/attachment.htm


More information about the Gc mailing list