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

Hans Boehm Hans.Boehm at hp.com
Sun Feb 1 11:52:23 PST 2009

On Sun, 1 Feb 2009, Ivan Maidanski wrote:

> Hi!
> ludo at gnu.org (Ludovic CourtХs) wrote:
>> Hi!
>> Ivan Maidanski <ivmai at mail.ru> writes:
>> 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'.
Ivan is right.  On some platforms it might work, but the collector
does not assume that the heap is contiguous.  In fact, it's conceivable
that dynamic libraries will be mapped between heap sections.  And the
"plausible_heap_addr" bounds are intentionally generous, to include
some potential future heap expansion.  (This helps black-listing of
blocks that appear to be referenced from static data and the like.)

This might even be an issue under Linux with large heaps on 32-bit 
systems, since the collector does eventually use mmap, which may 
interleave the heap with at least dlopened dynamic library data.  This may 
also interact with some of the address space randomization stuff.


More information about the Gc mailing list