[Gc] Crash in collector after adjusting root set

Boehm, Hans hans.boehm at hp.com
Mon Jun 19 17:25:33 PDT 2006

It would help to try this with just -g.  The stack trace doesn't seem to
contain the right mark_stack and mark_stack_top arguments.

The more interesting question is probably what the value of "limit" is.
This is the normal symptom of trying to mark from a root segment that
isn't actually mapped.  In that case limit should point to somewhere
inside a root segment.  If it points elsewhere, the question becomes how
that segment managed to make it onto the mark stack.

I would avoid setting GC_dont_precollect, unless you have a really good
reason.  A really large root set and a very small expected number of
collections might be a good reason.


> -----Original Message-----
> From: gc-bounces at napali.hpl.hp.com 
> [mailto:gc-bounces at napali.hpl.hp.com] On Behalf Of Laurynas Biveinis
> Sent: Sunday, June 18, 2006 5:26 AM
> To: gc at napali.hpl.hp.com
> Subject: [Gc] Crash in collector after adjusting root set
> 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.
> But after that first GC_collect() call crashes with
> Program received signal SIGSEGV, Segmentation fault.
> 0x01046191 in GC_mark_from (mark_stack_top=0x22e7b4, mark_stack=0x0,
>     mark_stack_limit=0x0) at 
> ../../../gcc-boehm-test/boehm-gc/mark.c:759
> 759               deferred = *limit;
> (gdb) bt
> #0  0x01046191 in GC_mark_from (mark_stack_top=0x22e7b4, 
> mark_stack=0x0,
>     mark_stack_limit=0x0) at 
> ../../../gcc-boehm-test/boehm-gc/mark.c:759
> #1  0x00000000 in ?? () from
> The collector is compiled with all debugging options I could find:
> "--enable-gc-debug --enable-full-debug"  
> collection is disabled (additionally GC_dont_precollect is 
> set). The collector is set up not to collect on allocation, 
> but rather when explicitly invoked. Platform is i686-pc-cygwin.
> I've tried not freeing, but zeroing out the old location of 
> the hash table, and not removing it from the root set - but 
> the crash is exactly the same.
> Any clues what went wrong here?
> --
> TIA,
> Laurynas
> _______________________________________________
> Gc mailing list
> Gc at linux.hpl.hp.com
> https://www.hpl.hp.com/hosted/linux/mail-archives/gc/

More information about the Gc mailing list