|
Muteki
EABI code execution on Besta® RTOS devices.
|
Memory management API. More...
#include "common.h"Go to the source code of this file.
Functions | |
| void * | lmalloc (size_t size) |
| Allocate heap memory. | |
| void * | lcalloc (size_t nmemb, size_t size) |
| Allocate and clear data units on the heap. | |
| void * | lrealloc (void *ptr, size_t size) |
| Resize or reallocate memory. | |
| void | _lfree (void *ptr) |
| Free previously allocated memory. | |
| size_t | GetFreeMemory (void) |
| Return the size of available memory. | |
Memory management API.
In Besta RTOS, heap memory management is entirely done in the OS kernel. All applications share a single heap managed by the OS and can be accessed through the malloc series API. Conventional address-space based heap memory management such as sbrk() is not supported due to the absence of MMU support in the OS kernel.
The simplest way to get heap memory support in a custom libc is to redirect malloc(), calloc(), realloc() and free() to the corresponding functions provided here.
|
extern |
Free previously allocated memory.
| ptr | Pointer to previously allocated memory. |
|
extern |
Return the size of available memory.
Requires -lkrnllib when dynamically linking with the shims.
|
extern |
Allocate and clear data units on the heap.
| nmemb | Number of data units to allocate. |
| size | Size of each data unit. |
|
extern |
Allocate heap memory.
| size | Size of the allocation in bytes. |
|
extern |
Resize or reallocate memory.
| ptr | Pointer to previously allocated memory. |
| size | New size in bytes. |