Xenomai
3.0.5
|
The implementation of the memory allocator follows the algorithm described in a USENIX 1988 paper called "Design of a General Purpose Memory Allocator for the 4.3BSD Unix Kernel" by Marshall K. More...
Functions | |
int | xnheap_init (struct xnheap *heap, void *membase, u32 size) |
Initialize a memory heap. More... | |
void | xnheap_set_name (struct xnheap *heap, const char *name,...) |
Set the heap's name string. More... | |
void | xnheap_destroy (struct xnheap *heap) |
Destroys a memory heap. More... | |
void * | xnheap_alloc (struct xnheap *heap, u32 size) |
Allocate a memory block from a memory heap. More... | |
void | xnheap_free (struct xnheap *heap, void *block) |
Release a block to a memory heap. More... | |
The implementation of the memory allocator follows the algorithm described in a USENIX 1988 paper called "Design of a General Purpose Memory Allocator for the 4.3BSD Unix Kernel" by Marshall K.
McKusick and Michael J. Karels. You can find it at various locations on the net, including http://docs.FreeBSD.org/44doc/papers/kernmalloc.pdf.
void * xnheap_alloc | ( | struct xnheap * | heap, |
u32 | size | ||
) |
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.
heap | The descriptor address of the heap to get memory from. |
size | The size in bytes of the requested block. Sizes lower or equal to the page size are rounded either to the minimum allocation size if lower than this value, or to the minimum alignment size if greater or equal to this value. In the current implementation, with MINALLOC = 8 and MINALIGN = 16, a 7 bytes request will be rounded to 8 bytes, and a 17 bytes request will be rounded to 32. |
void xnheap_destroy | ( | struct xnheap * | heap | ) |
Destroys a memory heap.
Destroys a memory heap.
heap | The heap descriptor. |
void xnheap_free | ( | struct xnheap * | heap, |
void * | block | ||
) |
Release a block to a memory heap.
Releases a memory block to a heap.
heap | The heap descriptor. |
block | The block to be returned to the heap. |
int xnheap_init | ( | struct xnheap * | heap, |
void * | membase, | ||
u32 | size | ||
) |
Initialize a memory heap.
Initializes a memory heap suitable for time-bounded allocation requests of dynamic memory.
heap | The address of a heap descriptor to initialize. |
membase | The address of the storage area. |
size | The size in bytes of the storage area. size must be a multiple of PAGE_SIZE and smaller than 2 Gb in the current implementation. |
void xnheap_set_name | ( | struct xnheap * | heap, |
const char * | name, | ||
... | |||
) |
Set the heap's name string.
Set the heap name that will be used in statistic outputs.
heap | The address of a heap descriptor. |
name | Name displayed in statistic outputs. This parameter can be a printk()-like format argument list. |