From: Russ Cox Date: Thu, 12 Feb 2009 01:54:03 +0000 (-0800) Subject: fix gc bug. i think this is tgs's second bug. X-Git-Tag: weekly.2009-11-06~2188 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=7cd24361bd66f11ec2beb1905052a3b73cdf3dac;p=gostls13.git fix gc bug. i think this is tgs's second bug. i stumbled across it in all.bash. TBR=r OCL=24912 CL=24912 --- diff --git a/src/runtime/malloc.c b/src/runtime/malloc.c index 163ca8c734..2bee176087 100644 --- a/src/runtime/malloc.c +++ b/src/runtime/malloc.c @@ -122,7 +122,7 @@ int32 mlookup(void *v, byte **base, uintptr *size, uint32 **ref) { uintptr n, nobj, i; - byte *p, *ep; + byte *p; MSpan *s; s = MHeap_LookupMaybe(&mheap, (uintptr)v>>PageShift); @@ -162,8 +162,11 @@ mlookup(void *v, byte **base, uintptr *size, uint32 **ref) *size = n; nobj = (s->npages << PageShift) / (n + RefcountOverhead); if((byte*)s->gcref < p || (byte*)(s->gcref+nobj) > p+(s->npages<base sizeclass %d %p gcref %p block %D\n", - s->sizeclass, p, s->gcref, s->npages<state, s, p, s->sizeclass, nobj, n, s->npages); + printf("s->base sizeclass %d v=%p base=%p gcref=%p blocksize=%D nobj=%d size=%D end=%p end=%p\n", + s->sizeclass, v, p, s->gcref, s->npages<gcref + nobj, p+(s->npages<map, p); if(s == nil || p < s->start || p - s->start >= s->npages) return nil; + if(s->state != MSpanInUse) + return nil; return s; }