[Gc] Crash in collector after adjusting root set

MenTaLguY mental at rydia.net
Mon Jun 19 17:28:50 PDT 2006


On Sun, 2006-06-18 at 14:25 +0200, Laurynas Biveinis wrote:
> Hi,
> 
> I'm experimenting with Boehm's GC as a garbage collector for GCC.
> Since not whole memory is managed by GC, I have to take care to
> register additional roots living in malloc'ed memory with
> GC_add_roots(). Majority of them are constant during program lifetime.
> However there is a malloc'ed hash table of identifiers that may get
> moved for expansion. If it moves I try to adjust collector's idea of
> root set by calling GC_remove_roots() for the old table and
> registering the new roots with GC_add_roots(). I've checked with
> GC_dump that after this collector has the correct set of roots.

Personally, I have found allocating such structures with
GC_MALLOC_ATOMIC() useful, rather than registering them as GC roots
directly.

-mental




More information about the Gc mailing list