Memory#
This module includes the platform abstraction for dynamic memory allocation.
Functions#
void *
otPlatCAlloc(size_t aNum, size_t aSize)
Dynamically allocates new memory.
void
otPlatFree(void *aPtr)
Frees memory that was dynamically allocated by otPlatCAlloc().
Function Documentation#
otPlatCAlloc#
void * otPlatCAlloc (size_t aNum, size_t aSize)
Dynamically allocates new memory.
Parameters
| Type | Direction | Argument Name | Description |
|---|---|---|---|
| size_t | [in] | aNum | The number of blocks to allocate |
| size_t | [in] | aSize | The size of each block to allocate |
On platforms that support it, they should redirect to calloc. For those that don't support calloc, they should implement the standard calloc behavior.
See: https://man7.org/linux/man-pages/man3/calloc.3.html
Is required for OPENTHREAD_CONFIG_HEAP_EXTERNAL_ENABLE.
otPlatFree#
void otPlatFree (void * aPtr)
Frees memory that was dynamically allocated by otPlatCAlloc().
Parameters
| Type | Direction | Argument Name | Description |
|---|---|---|---|
| void * | [in] | aPtr | A pointer the memory blocks to free. The pointer may be NULL. |
Is required for OPENTHREAD_CONFIG_HEAP_EXTERNAL_ENABLE.