[Gc] Does GC_get_heap_size() accurately report the total amount of heap used by the Boehm GC?

Christian Schafmeister <[email protected]> Sat, 07 Jun 2014 11:42:16 -0400
Newsgroups gmane.comp.programming.garbage-collection.boehmgc
Message-ID <[email protected]>
I started a new thread because in the other thread we are starting to blame the Boehm GC when it might be my code that is leaking memory.

I’m starting to think my memory leak is not related to Boehm. 
The total virtual memory 30GB is MUCH larger than the 2GB memory reported by GC_get_heap_size().

Two questions:
1) Does GC_get_heap_size() accurately reflect the total heap used by the Boehm GC?
2) Can I use a debugging malloc library like dmalloc to debug memory leaks while at the same time running the Boehm GC?

I have written a program (a Common Lisp compiler that uses LLVM as the back end) that runs a C++ static analyzer for 5 hours and its memory consumption balloons to 30 GB and then sometimes crashes before it completes.
This morning the static analyzer ran to completion and using the OS X program “Activity Monitor” I can see that the process consumes 30GB of virtual memory.

When the static analyzer completed it queried the Boehm GC to get info on memory usage according to Boehm:
Total memory usage (bytes):          541,259,440   ;; Sum of sizes of reachable objects obtained by walking the Boehm heap using code provided by Peter Wang
Total GC_get_heap_size()           1,943,457,792   ;; about 2GB - that’s reasonable - it’s NOT 30GB
Total GC_get_total_bytes()     1,467,004,314,013   ;; Total bytes allocated about 1,500 GB - clearly garbage collection is working!


In gc.h it says:
/* Return the number of bytes in the heap.  Excludes collector private	*/
/* data structures.  Includes empty blocks and fragmentation loss.	*/
/* Includes some pages that were allocated but never written.		*/
GC_API size_t GC_get_heap_size GC_PROTO((void));

_______________________________________________
bdwgc mailing list
[email protected]
https://lists.opendylan.org/mailman/listinfo/bdwgc