Typedefs |
| typedef void(* | malloc_handler )(int size) |
| typedef void *(* | malloc_hook )(int size) |
| typedef void(* | free_hook )(void *ptr) |
| typedef void *(* | realloc_hook )(void *ptr, int size) |
| typedef int(* | block_size_hook )(void *ptr) |
Functions |
| void * | malloc (int size) |
| | Allocate uninitialized memory. Allocates memory from the mosync heap.
|
| void * | calloc (int num_elem, int size_elem) |
| | Allocate initialized memory. Allocates memory from the mosync heap and sets the contents to null.
|
| void | free (void *mem) |
| | Deallocate memory. Deallocates memory from the mosync heap.
|
| void * | realloc (void *old, int size) |
| | Reallocate memory. Attempts to resize a previously allocated block of memory. If successful, returns a pointer to the resized memory block. The pointer may be identical to the old, or different. Returns NULL on failure, leaving the old memory block untouched. If old is NULL, a new block is allocated. If size is 0, the block is freed, and NULL is returned.
|
| size_t | heapTotalMemory (void) |
| size_t | heapFreeMemory (void) |
| void | default_malloc_handler (int size) __attribute__((noreturn)) |
| malloc_handler | set_malloc_handler (malloc_handler) |
| malloc_hook | set_malloc_hook (malloc_hook hook) |
| free_hook | set_free_hook (free_hook hook) |
| realloc_hook | set_realloc_hook (realloc_hook hook) |
| block_size_hook | set_block_size_hook (block_size_hook hook) |
| void | override_heap_init_crt0 (char *start, int length) |
| void | ansi_heap_init_crt0 (char *start, int length) |
| void | initStackDump (void) |
Dynamic memory allocation.
| void* realloc |
( |
void * |
old, |
|
|
int |
size |
|
) |
| |
Reallocate memory. Attempts to resize a previously allocated block of memory. If successful, returns a pointer to the resized memory block. The pointer may be identical to the old, or different. Returns NULL on failure, leaving the old memory block untouched. If old is NULL, a new block is allocated. If size is 0, the block is freed, and NULL is returned.
- Parameters:
-
| old | The old block of memory. |
| size | The requested size. |
This function is not implemented. You may implement it. If you do, it will be called at the beginning of execution, instead of the standard heap initialization function, before C++ static constructors and MAMain.
You must call set_malloc_hook() and set_free_hook() from this function, or the heap will be broken and malloc() will not work. You must also call set_realloc_hook(), if your program uses realloc().
This function will only be called on the MAPIP GCC target, because the optional call to this function relies on a special feature of pipe-tool.
- Parameters:
-
| start | The address of the start of the heap. |
| length | The length of the heap, in bytes. |