Re: [Gc] Re: [PATCH] Allow registration of disappearing links on non-heapobjects

Ivan Maidanski ivmai at mail.ru
Sat Jan 31 23:42:49 PST 2009


Hi!

ludo at gnu.org (Ludovic CourtХs) wrote:
> 
> Hi!
> 
> Ivan Maidanski <ivmai at mail.ru> writes:
> 
> > This is not a bug, it's the known behavior - see the comment for
> > GC_general_register_disappearing_link() in gc.h: "Obj MUST be a
> > pointer to the first word of an object we ALLOCATED".  I fact, I ran
> > into this problem too
> 
> Oops, had missed this one.
> 
> > - see
> > http://www.hpl.hp.com/hosted/linux/mail-archives/gc/2008-October/002400.html.
> > This had 2 consequences: - for GC: addition of GC_ASSERT clause to
> > GC_general_register_disappearing_link(); - for me: I added
> > GC_base(obj) != NULL check before calling
> > GC_general_register_disappearing_link() where obj could be a non-heap
> > one.
> 
> In my case, I added a test that checks whether the pointer is in between
> GC_{least,greatest}_plausible_heap_addr.  Presumably, this is more
> efficient than calling `GC_base ()'?

This should be correct for static objects (as in Your sample).
But I'm not sure for automatic objects. Is it possible that some thread's stack lies between two heap blocks?

> Ludo'.
> 

Bye.



More information about the Gc mailing list