![]() |
EVE 1.0
|
![]() |
Files | |
file | mmem.c |
file | mmem.h |
Macros | |
#define | MMEM_PTR(m) |
Get a pointer to the managed memory. More... | |
Functions | |
int | mmem_alloc (struct mmem *m, unsigned int size) |
Allocate a managed memory block. More... | |
void | mmem_free (struct mmem *m) |
Deallocate a managed memory block. More... | |
void | mmem_init (void) |
Initialize the managed memory module. More... | |
The managed memory allocator is a fragmentation-free memory manager. It keeps the allocated memory free from fragmentation by compacting the memory when blocks are freed. A program that uses the managed memory module cannot be sure that allocated memory stays in place. Therefore, a level of indirection is used: access to allocated memory must always be done using a special macro.
#define MMEM_PTR | ( | m | ) |
int mmem_alloc | ( | struct mmem * | m, |
unsigned int | size | ||
) |
Allocate a managed memory block.
m | A pointer to a struct mmem. |
size | The size of the requested memory block |
Definition at line 83 of file mmem.c.
References list_add().
void mmem_free | ( | struct mmem * | m | ) |
Deallocate a managed memory block.
m | A pointer to the managed memory block |
Definition at line 119 of file mmem.c.
References list_remove().
void mmem_init | ( | void | ) |
Initialize the managed memory module.
Definition at line 152 of file mmem.c.
References list_init().