[Gc] Re: Boehm GC + Thread Building Blocks

Boehm, Hans hans.boehm at hp.com
Fri Jun 29 13:01:50 PDT 2012


Are you sure that you're really getting the worker threads registered, and not just getting lucky and always triggering the GC from the main thread, or a separately registered thread?

I don't think there's currently a debugging routine that dumps the registered threads.  There probably should be.  There are many routines in pthread_support.c that walk the thread table, and could be easily imitated to build such a routine; GC_mark_thread_local_free_lists() is a simple example.

Stack overflows are likely to be an issue, if you use the common approach of catching a SIGSEGV on an alternate stack.  The GC doesn't know about the alternate stack.  The best solution is probably to disable collection while on the alternate stack, and to arrange for GC-generated signals to be held while in the handler.  That way the GC should never catch a thread on the alternate stack.

Hans

> -----Original Message-----
> From: gc-bounces at linux.hpl.hp.com [mailto:gc-bounces at linux.hpl.hp.com]
> On Behalf Of aherz
> Sent: Friday, June 29, 2012 2:13 AM
> To: gc at linux.hpl.hp.com
> Subject: Re: [Gc] Re: Boehm GC + Thread Building Blocks
> 
> Ivan Maidanski <ivmai at ...> writes:
> 
> >
> > Hi Alexander,
> >
> > What's your target?
> >
> > Have you explicitly initialize GC and register threads?
> >
> > Regards,
> > Ivan
> >
> > Tue, 26 Jun 2012 12:47:16 +0000 (UTC) от aherz <alexander.herz <at>
> mytum.de>:
> > > hm..I'm now getting some strange, possibly related problems:
> > >
> > > Mostly, the ap terminates without any problems. Sometimes,
> > > in one of the tbb worker threads, a SIGPWR
> > > (wiki says this might be used by boehm gc)
> > > is received and afterwards I get a "Collection in unknown thread"
> error.
> > >
> > > Maybe tbb's signal handling is interfering with boehm's?
> > >
> > > Btw: I also get an "Collection in unknown thread" when a stack
> overflow is
> > > triggered.
> > >
> > > Alex
> > >
> > >
> > >
> > > _______________________________________________
> > > Gc mailing list
> > > Gc at ...
> > > http://www.hpl.hp.com/hosted/linux/mail-archives/gc/
> > >
> >
> 
> 
> Hi Ivan,
> 
> my target is a 64bit ubuntu (10.04). I compile the tbb library from
> source and
> added the #define GC_THREADS and #include <gc_cpp.h> to the library.
> The garbage collector does work (mostly when I run the application with
> gc debug
> output, I can see that collections happen, so the threads are
> registered). So
> mostly things work ok, only in rare circumstances something goes wrong.
> I don't
> think that the problem is the registration of the threads.
> I think the problem is that tbb implements its own exception handling
> and that
> might interfere with boehm gc's signals.
> Is there an easy way to make boehm gc dump which threads have been
> registered to
> verify that this is not the problem?
> 
> Thx,
> Alex
> 
> _______________________________________________
> Gc mailing list
> Gc at linux.hpl.hp.com
> http://www.hpl.hp.com/hosted/linux/mail-archives/gc/



More information about the Gc mailing list