Morse Micro IoT SDK  2.11.2

Detailed Description

Provides memory management functionality (allocation and free).

Macros

#define mmosal_malloc(size)   mmosal_malloc_(size)
 Allocate memory of the given size and return a pointer to it (malloc). More...
 
#define mmosal_calloc(nitems, size)   mmosal_calloc_(nitems, size)
 Equivalent of standard library calloc(). More...
 
#define mmosal_realloc(ptr, size)   mmosal_realloc_(ptr, size)
 Equivalent of standard library realloc(). More...
 

Functions

void * mmosal_malloc_ (size_t size)
 Allocate memory of the given size and return a pointer to it (malloc). More...
 
void * mmosal_malloc_dbg (size_t size, const char *name, unsigned line_number)
 Allocate memory of the given size and return a pointer to it (malloc) – debug version. More...
 
void * mmosal_calloc_dbg (size_t nitems, size_t size, const char *name, unsigned line_number)
 Equivalent of standard library calloc(). More...
 
void * mmosal_realloc_dbg (void *ptr, size_t size, const char *name, unsigned line_number)
 Equivalent of standard library realloc(). More...
 
void mmosal_free (void *p)
 Free the given memory allocation. More...
 
void * mmosal_realloc_ (void *ptr, size_t size)
 Equivalent of standard library realloc(). More...
 
void * mmosal_calloc_ (size_t nitems, size_t size)
 Equivalent of standard library calloc(). More...
 

Macro Definition Documentation

◆ mmosal_calloc

#define mmosal_calloc (   nitems,
  size 
)    mmosal_calloc_(nitems, size)

Equivalent of standard library calloc().

Parameters
nitemsNumber of blocks to allocate
sizeSize of each block.
Returns
pointer to the allocated memory on success, or NULL on failure.

Definition at line 180 of file mmosal.h.

◆ mmosal_malloc

#define mmosal_malloc (   size)    mmosal_malloc_(size)

Allocate memory of the given size and return a pointer to it (malloc).

No guarantees made about initialization.

Parameters
sizeThe amount of memory to allocate (in bytes).
Returns
pointer to the allocated memory on success, or NULL on failure.

Definition at line 170 of file mmosal.h.

◆ mmosal_realloc

#define mmosal_realloc (   ptr,
  size 
)    mmosal_realloc_(ptr, size)

Equivalent of standard library realloc().

Parameters
ptrPreviously allocated memory block to resize.
sizeThe new size.
Returns
pointer to the resized block of memory, or NULL.

Definition at line 190 of file mmosal.h.

Function Documentation

◆ mmosal_calloc_()

void * mmosal_calloc_ ( size_t  nitems,
size_t  size 
)

Equivalent of standard library calloc().

Warning
This function should not be used directly. Instead use mmosal_calloc().
Parameters
nitemsNumber of blocks to allocate
sizeSize of each block.
Returns
pointer to the allocated memory on success, or NULL on failure.

◆ mmosal_calloc_dbg()

void * mmosal_calloc_dbg ( size_t  nitems,
size_t  size,
const char *  name,
unsigned  line_number 
)

Equivalent of standard library calloc().

Warning
This function should not be used directly. Instead use mmosal_calloc().
Parameters
nitemsNumber of blocks to allocate
sizeSize of each block.
nameName of the function that allocated the memory.
line_numberThe line number at which the allocation happened.
Returns
pointer to the allocated memory on success, or NULL on failure.

◆ mmosal_free()

void mmosal_free ( void *  p)

Free the given memory allocation.

Parameters
pThe memory to free.

◆ mmosal_malloc_()

void * mmosal_malloc_ ( size_t  size)

Allocate memory of the given size and return a pointer to it (malloc).

No guarantees made about initialization.

Warning
This function should not be used directly. Instead use mmosal_malloc().
Parameters
sizeThe amount of memory to allocate (in bytes).
Returns
pointer to the allocated memory on success, or NULL on failure.

◆ mmosal_malloc_dbg()

void * mmosal_malloc_dbg ( size_t  size,
const char *  name,
unsigned  line_number 
)

Allocate memory of the given size and return a pointer to it (malloc) – debug version.

No guarantees made about initialization.

Warning
This function should not be used directly. Instead use mmosal_malloc().
Parameters
sizeThe amount of memory to allocate (in bytes).
nameName of the function that allocated the memory.
line_numberThe line number at which the allocation happened.
Returns
pointer to the allocated memory on success, or NULL on failure.

◆ mmosal_realloc_()

void * mmosal_realloc_ ( void *  ptr,
size_t  size 
)

Equivalent of standard library realloc().

Warning
This function should not be used directly. Instead use mmosal_realloc().
Parameters
ptrPreviously allocated memory block to resize.
sizeThe new size.
Returns
pointer to the resized block of memory, or NULL.

◆ mmosal_realloc_dbg()

void * mmosal_realloc_dbg ( void *  ptr,
size_t  size,
const char *  name,
unsigned  line_number 
)

Equivalent of standard library realloc().

Warning
This function should not be used directly. Instead use mmosal_realloc().
Parameters
ptrPreviously allocated memory block to resize.
sizeThe new size.
nameName of the function that allocated the memory.
line_numberThe line number at which the allocation happened.
Returns
pointer to the resized block of memory, or NULL.