1 // Copyright 2009 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
5 // Fixed-size object allocator. Returned memory is not zeroed.
7 // See malloc.h for overview.
13 // Initialize f to allocate objects of the given size,
14 // using the allocator to obtain chunks of memory.
16 runtime_FixAlloc_Init(FixAlloc
*f
, uintptr size
, void (*first
)(void*, byte
*), void *arg
, uint64
*stat
)
29 runtime_FixAlloc_Alloc(FixAlloc
*f
)
34 runtime_printf("runtime: use of FixAlloc_Alloc before FixAlloc_Init\n");
35 runtime_throw("runtime: internal error");
40 f
->list
= *(void**)f
->list
;
44 if(f
->nchunk
< f
->size
) {
45 f
->chunk
= runtime_persistentalloc(FixAllocChunk
, 0, f
->stat
);
46 f
->nchunk
= FixAllocChunk
;
58 runtime_FixAlloc_Free(FixAlloc
*f
, void *p
)