| // Copyright 2009 The Go Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style |
| // license that can be found in the LICENSE file. |
| // Fixed-size object allocator. Returned memory is not zeroed. |
| // See malloc.h for overview. |
| // Initialize f to allocate objects of the given size, |
| // using the allocator to obtain chunks of memory. |
| runtime·FixAlloc_Init(FixAlloc *f, uintptr size, void (*first)(void*, byte*), void *arg, uint64 *stat) |
| runtime·FixAlloc_Alloc(FixAlloc *f) |
| runtime·printf("runtime: use of FixAlloc_Alloc before FixAlloc_Init\n"); |
| runtime·throw("runtime: internal error"); |
| f->list = *(void**)f->list; |
| if(f->nchunk < f->size) { |
| f->chunk = runtime·persistentalloc(FixAllocChunk, 0, f->stat); |
| f->nchunk = FixAllocChunk; |
| runtime·FixAlloc_Free(FixAlloc *f, void *p) |