Format
#include <umalloc.h> Heap_t _udefault(Heap_t heap);
Language Level: Extension
_udefault makes the heap you specify become the
default heap. All calls to memory management functions that do
not specify a heap (including malloc and calloc) then allocate
memory from the heap.
This change affects only the thread where you called _udefault.
The initial default heap is the IBM C and C++ Compilers runtime heap. To restore or explicitly set the IBM C and C++ Compilers runtime heap as the default, call _udefault with the argument _RUNTIME_HEAP.
You can also use _udefault to find out which heap is being used as the default by specifying NULL for the heap parameter. The default heap remains the same.
Return Value
_udefault returns a pointer to the former default heap.
You can save this pointer and use it later to restore the
original heap. If the call is unsuccessful, _udefault returns
NULL. Passing _udefault a heap that is not valid results in
undefined behavior.
![]()
calloc -- Reserve and Initialize Storage
malloc -- Reserve Storage Block
_mheap -- Query Memory Heap for
Allocated Object
_ucreate -- Create a Memory Heap
<umalloc.h>