Use explicit allspan list instead of trying to find all the places where spans might be recorded. Free can cascade into complicated span manipulations that move them from list to list; the old code had the possibility of accidentally processing a span twice or jumping to a different list, causing an infinite loop. R=r DELTA=70 (28 added, 25 deleted, 17 changed) OCL=23704 CL=23710
diff --git a/src/runtime/mfixalloc.c b/src/runtime/mfixalloc.c index 904ca7e..dd4f3f2 100644 --- a/src/runtime/mfixalloc.c +++ b/src/runtime/mfixalloc.c
@@ -12,10 +12,12 @@ // Initialize f to allocate objects of the given size, // using the allocator to obtain chunks of memory. void -FixAlloc_Init(FixAlloc *f, uintptr size, void *(*alloc)(uintptr)) +FixAlloc_Init(FixAlloc *f, uintptr size, void *(*alloc)(uintptr), void (*first)(void*, byte*), void *arg) { f->size = size; f->alloc = alloc; + f->first = first; + f->arg = arg; f->list = nil; f->chunk = nil; f->nchunk = 0; @@ -38,6 +40,8 @@ f->nchunk = FixAllocChunk; } v = f->chunk; + if(f->first) + f->first(f->arg, v); f->chunk += f->size; f->nchunk -= f->size; return v;