Module to declare Memory Manager API. More...
Functions |
|
| void | sys_mm_init (void *p_start, size_t size) |
|
Function for initializing the memory manager.
More...
|
|
| void * | sys_mm_alloc (size_t size) |
|
Function for allocating memory in the pool.
More...
|
|
| void | sys_mm_free (void *p_addr) |
|
Function for freeing the allocated memory.
More...
|
|
Detailed Description
Module to declare Memory Manager API.
The Memory Manager module implements the standard API for allocating/freeing memory chunks. The module must be initialized by sys_mm_init() before a call to any alloc/free routines. The memory can be allocated by a call to sys_mm_alloc() and freed by a call to sys_mm_free() . Minimal chunk of memory to allocate is one byte, however the sys_mm_alloc() routine will allocate the number of bytes aligned to the length of the machine word (e.g. 4 bytes for 32-bit architectures). The module is implemented using the doubly linked lists API.
Function Documentation
| void* sys_mm_alloc | ( | size_t | size | ) |
Function for allocating memory in the pool.
Search and allocate free memory resources.
- Parameters
-
[in] size Size of the requested memory.
- Return values
-
Pointer to allocated memory, NULL in case of error.
| void sys_mm_free | ( | void * | p_addr | ) |
Function for freeing the allocated memory.
- Parameters
-
[in] p_addr Pointer to the memory to free.
| void sys_mm_init | ( | void * | p_start , |
| size_t | size | ||
| ) |
Function for initializing the memory manager.
Initialize the memory manager pool of the 'size' bytes length at 'p_start' address.
- Parameters
-
p_start Pool start address. size Size of the pool in bytes.