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 *(*alloc
)(uintptr
), void (*first
)(void*, byte
*), void *arg
)
30 runtime_FixAlloc_Alloc(FixAlloc
*f
)
36 f
->list
= *(void**)f
->list
;
40 if(f
->nchunk
< f
->size
) {
41 f
->sys
+= FixAllocChunk
;
42 f
->chunk
= f
->alloc(FixAllocChunk
);
44 runtime_throw("out of memory (FixAlloc)");
45 f
->nchunk
= FixAllocChunk
;
57 runtime_FixAlloc_Free(FixAlloc
*f
, void *p
)