Implements the nanokernel memory allocator based on the algorithm described in "Design of a General Purpose Memory Allocator for the 4.3BSD Unix Kernel" by Marshall K. McKusick and Michael J. Karels.
Files | |
file | heap.c |
Dynamic memory allocation services. | |
Functions | |
int | xnheap_init (xnheap_t *heap, void *heapaddr, u_long heapsize, u_long pagesize) |
Initialize a memory heap. | |
void | xnheap_destroy (xnheap_t *heap) |
Destroys a memory heap. | |
void * | xnheap_alloc (xnheap_t *heap, u_long size, xnflags_t flags) |
Allocate a memory block from a memory heap. | |
int | xnheap_free (xnheap_t *heap, void *block) |
Release a memory block to a memory heap. |
|
Allocate a memory block from a memory heap. Allocates a contiguous region of memory from an active memory heap. Such allocation is guaranteed to be time-bounded if the heap is non-extendable (see xnheap_init()). Otherwise, it might trigger a dynamic extension of the storage area through an internal request to the host operating environment.
Context: This routine can always be called on behalf of a thread context. It can also be called on behalf of an IST context if the heap storage area has been statically-defined at initialization time (see xnheap_init()). |
|
Destroys a memory heap. Destroys a memory heap. Dynamically allocated extents are returned to the host operating environment.
Context: This routine must be called on behalf of a thread context. |
|
Release a memory block to a memory heap. Releases a memory region to the memory heap it was previously allocated from.
Context: This routine can be called on behalf of a thread or IST context |
|
Initialize a memory heap. Initializes a memory heap suitable for dynamic memory allocation requests. The heap manager can operate in two modes, whether time-bounded if the heap storage area and size are statically defined at initialization time, or dynamically extendable at the expense of a less deterministic behaviour.
Context: This routine must be called on behalf of a thread context. |