FreeRTOS memory management.
More...
|
void * | pb_malloc (size_t sz) |
| Allocate a contiguous chunk of memory.
|
|
void | pb_free (void *ptr) |
| Free a chunk of memory previously allocated with pb_malloc()
|
|
__weak void * | pb_realloc (void *ptr, size_t sz) |
| Resize the memory area ptr to size sz .
|
|
__weak void * | pb_memcpy (void *dest, const void *src, size_t sz) |
| copy a memory region
|
|
__weak int | pb_memcmp (const void *a, const void *b, size_t sz) |
| compare two memory regions
|
|
◆ pb_free()
void pb_free |
( |
void * | ptr | ) |
|
|
inline |
- Parameters
-
ptr | Pointer to memory area |
◆ pb_malloc()
void * pb_malloc |
( |
size_t | sz | ) |
|
|
inline |
- Parameters
-
sz | Requested size of memory area |
- Returns
- Pointer to memory area, or
NULL
on failure
- Note
- The allocated memory must be free'd again using
pb_free()
◆ pb_memcmp()
__weak int pb_memcmp |
( |
const void * | a, |
|
|
const void * | b, |
|
|
size_t | sz ) |
- Parameters
-
a | Pointer to first memory region |
b | Pointer to second memory region |
sz | Number of bytes to compare |
- Returns
- 0 if the memory regions are identical, or the difference between the first non-matching byte
This function has a portable implementation, and is always available.
◆ pb_memcpy()
__weak void * pb_memcpy |
( |
void * | dest, |
|
|
const void * | src, |
|
|
size_t | sz ) |
- Parameters
-
dest | Pointer to destination memory |
src | Pointer to source memory |
sz | Number of bytes to copy |
- Returns
- Pointer to
dest
This function has a portable implementation, and is always available.
◆ pb_realloc()
__weak void * pb_realloc |
( |
void * | ptr, |
|
|
size_t | sz ) |
|
inline |
- Parameters
-
ptr | Pointer to allocated memory area |
sz | Requested new size of memory area |
- Returns
- Pointer to memory area, or
NULL
on failure
- Warning
- This function is not available on FreeRTOS, and should be avoided if possible. MPack's
mpack_writer_init_growable()
is known to use realloc()
, and should not be used for this reason.