|
Embedded SDK
Embedded SDK
|
#include <stdint.h>#include <string.h>#include "os_helpers.h"#include "os_print.h"#include "mem_alloc.h"#include "app_mem_utils.h"
Go to the source code of this file.
Functions | |
| bool | mem_utils_init (void *heap_start, size_t heap_size) |
| Initializes the App heap buffer. | |
| void * | mem_utils_alloc (size_t size, bool permanent, const char *file, int line) |
| Internal implementation of memory allocation. | |
| void * | mem_utils_realloc (void *ptr, size_t size, const char *file, int line) |
| Internal implementation of memory reallocation. | |
| void | mem_utils_free (void *ptr, const char *file, int line) |
| Internal implementation of memory free. | |
| bool | mem_utils_calloc (void **buffer, uint16_t size, bool permanent, const char *file, int line) |
| Internal implementation of memory allocation of a zero-initialized buffer freeing any existing allocation. | |
| void | mem_utils_free_and_null (void **buffer, const char *file, int line) |
| Internal implementation of safe free with nullification. | |
| char * | mem_utils_strdup (const char *src, const char *file, int line) |
| Internal implementation of string duplication. | |
| void * mem_utils_alloc | ( | size_t | size, |
| bool | permanent, | ||
| const char * | file, | ||
| int | line | ||
| ) |
Internal implementation of memory allocation.
| [in] | size | in bytes to allocate (must be > 0) |
| [in] | permanent | if true, the allocation is never freed (for profiling only) |
| [in] | file | source file requesting the allocation (for profiling only) |
| [in] | line | line in the source file requesting the allocation (for profiling only) |
Definition at line 48 of file app_mem_utils.c.
| bool mem_utils_calloc | ( | void ** | buffer, |
| uint16_t | size, | ||
| bool | permanent, | ||
| const char * | file, | ||
| int | line | ||
| ) |
Internal implementation of memory allocation of a zero-initialized buffer freeing any existing allocation.
| [out] | buffer | pointer to the buffer to allocate |
| [in] | size | (in bytes) to allocate |
| [in] | permanent | if true, the allocation is never freed (for profiling only) |
| [in] | file | source file requesting the allocation (for profiling only) |
| [in] | line | line in the source file requesting the allocation (for profiling only) |
Definition at line 128 of file app_mem_utils.c.
| void mem_utils_free | ( | void * | ptr, |
| const char * | file, | ||
| int | line | ||
| ) |
Internal implementation of memory free.
| [in] | ptr | previously allocated |
| [in] | file | source file requesting the allocation (for profiling only) |
| [in] | line | line in the source file requesting the allocation (for profiling only) |
Definition at line 107 of file app_mem_utils.c.
| void mem_utils_free_and_null | ( | void ** | buffer, |
| const char * | file, | ||
| int | line | ||
| ) |
Internal implementation of safe free with nullification.
| [in,out] | buffer | Pointer to the buffer to deallocate |
| [in] | file | source file requesting the allocation (for profiling only) |
| [in] | line | line in the source file requesting the allocation (for profiling only) |
Definition at line 157 of file app_mem_utils.c.
| bool mem_utils_init | ( | void * | heap_start, |
| size_t | heap_size | ||
| ) |
Initializes the App heap buffer.
| [in] | heap_start | address of the Application heap to use |
| [in] | heap_size | size in bytes of the heap |
Definition at line 30 of file app_mem_utils.c.
| void * mem_utils_realloc | ( | void * | ptr, |
| size_t | size, | ||
| const char * | file, | ||
| int | line | ||
| ) |
Internal implementation of memory reallocation.
| [in] | ptr | previously allocated or NULL (equivalent to alloc) |
| [in] | size | new size in bytes to allocate. Can be 0 (equivalent to free). |
| [in] | file | source file requesting the allocation (for profiling only) |
| [in] | line | line in the source file requesting the allocation (for profiling only) |
Definition at line 76 of file app_mem_utils.c.
| char * mem_utils_strdup | ( | const char * | src, |
| const char * | file, | ||
| int | line | ||
| ) |
Internal implementation of string duplication.
| [in] | src | string to duplicate |
| [in] | file | source file requesting the allocation (for profiling only) |
| [in] | line | line in the source file requesting the allocation (for profiling only) |
Definition at line 173 of file app_mem_utils.c.