puzzlebox
Loading...
Searching...
No Matches

FreeRTOS memory management. More...

Detailed Description

Functions

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
 

Function Documentation

◆ pb_free()

void pb_free ( void * ptr)
inline
Parameters
ptrPointer to memory area

◆ pb_malloc()

void * pb_malloc ( size_t sz)
inline
Parameters
szRequested 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
aPointer to first memory region
bPointer to second memory region
szNumber 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
destPointer to destination memory
srcPointer to source memory
szNumber 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
ptrPointer to allocated memory area
szRequested 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.