[Gc] Getting started with Boehm GC

Benjamin Smedberg benjamin at smedbergs.us
Mon Aug 18 07:09:01 PDT 2008

Hash: SHA1

I am working on a project to unify the memory management of the Mozilla
browser... we currently are using spidermonkey home-grown exact GC for JS
management and COM-like reference counting with a homegrown cycle collector
for the DOM and other objects. I am experimenting with switching everything
over to use boehm GC.

In order to get a first cut guess of allocation speed and statistics on
memory fragmentation in the allocator, I am starting out replacing malloc()
with GC_malloc_uncollectable. If I understand GC_malloc_uncollectable
correctly, this should cause malloced memory to be scanned, but will never
be collected (it will still require explicit deallocation). Is this correct?

I have been experiencing random crashes in the code... pointers are NULL
which shouldn't ever be, and other behaviors which don't make any sense. I
tried running the app under valgrind, but didn't get any useful information
after writing a suppression file for uninitialized memory use in the GC
which I imagine is normal. Does boehmgc have any valgrind annotations to
provide useful annotations for overwriting heap data, mismatched
malloc/free, etc?

I haven't figured out how to use gc-debug in my situation yet... is there a
debugging symbol similar to GC_malloc_uncollectable that I can interpose for
malloc() which would provide warnings about a corrupted heap?

- --BDS
Version: GnuPG v1.4.5 (Darwin)
Comment: Using GnuPG with Mozilla - https://enigmail.mozdev.org


More information about the Gc mailing list