[Gc] Re: [bdwgc] Add disclaim callback and a "finalized" object kind (#5)

Petter Urkedal urkedal at nbi.dk
Tue Apr 10 15:31:35 PDT 2012


On 2012-04-11, Ivan Maidanski wrote:
> Hi Petter,
> 
> Tue, 10 Apr 2012 19:31:43 +0200 Petter Urkedal <urkedal at nbi.dk>:
> > On 2012-04-10, Ivan Maidanski wrote:
> > > Hi Petter,
> > > 
> > > There's a bug in Disclaim functionality. I've improved disclaim_test to detect the bug. Please fix it.
> > > I put it temporarily to another branch (to prevent master break) - https://github.com/ivmai/bdwgc/compare/disclaim-test-add
> > > 
> > > Thanks.
> > 
> > Hi Ivan,
> > 
> > I can't reproduce this.
> 
> I guess you tried on x64

Yes.  I'll arrange access to an x86 tomorrow.

> >  I guess it's the new
> > 
> >     my_assert(log_size < sizeof(size_t) * 8);
> 
> yes.
> 
> > 
> > which fails?  Which configure options to you use?
> 
> It fails with any option I tried.
> Test environments: cygwin, ubuntu/x86, darwin/arm, android/arm.
> 
> In fact, arm targets fail even without the added assertion - because of different behavior of shift (the left operand is multiple to 32, x86 returns 1, arm return 0 in that case, thus size-1 is UINT_MAX). 

So I guess the actual value in that first byte is the first byte of a
pointer from the free-list.

> >  Also, could you check
> > the GC_size and dump the first bytes from "obj" to see if the object is
> > trashed or if it's just the first byte or word?
> 
> Brief debugging showed that GC_disclaim_and_reclaim_or_free_small_block -> GC_disclaim_and_reclaim calls (at some moment) (*disclaim)(p) with p not returned by GC_finalized_malloc.

It's expected that disclaim gets called on objects from the free list,
but these are assumed to be zeroed except for the first word, in which
case GC_finalized_disclaim should have gotten "fc == NULL" and skipped
the fc->proc call.  I can spot the mistake right now, but hopefully I
will be able to reproduce it on x86/RHEL.

Petter


More information about the Gc mailing list