diff options
Diffstat (limited to 'libgo/runtime/mfixalloc.c')
-rw-r--r-- | libgo/runtime/mfixalloc.c | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/libgo/runtime/mfixalloc.c b/libgo/runtime/mfixalloc.c index 6e4f0c6e607..9d0b3bbda7e 100644 --- a/libgo/runtime/mfixalloc.c +++ b/libgo/runtime/mfixalloc.c @@ -13,17 +13,16 @@ // Initialize f to allocate objects of the given size, // using the allocator to obtain chunks of memory. void -runtime_FixAlloc_Init(FixAlloc *f, uintptr size, void *(*alloc)(uintptr), void (*first)(void*, byte*), void *arg) +runtime_FixAlloc_Init(FixAlloc *f, uintptr size, void (*first)(void*, byte*), void *arg, uint64 *stat) { f->size = size; - f->alloc = alloc; f->first = first; f->arg = arg; f->list = nil; f->chunk = nil; f->nchunk = 0; f->inuse = 0; - f->sys = 0; + f->stat = stat; } void* @@ -43,10 +42,7 @@ runtime_FixAlloc_Alloc(FixAlloc *f) return v; } if(f->nchunk < f->size) { - f->sys += FixAllocChunk; - f->chunk = f->alloc(FixAllocChunk); - if(f->chunk == nil) - runtime_throw("out of memory (FixAlloc)"); + f->chunk = runtime_persistentalloc(FixAllocChunk, 0, f->stat); f->nchunk = FixAllocChunk; } v = f->chunk; |