Syntax
#include <umalloc.h> Heap_t _mheap(void *ptr);Description
For more information about creating and using heaps, see the chapter on Managing Memory in the VisualAge C++ Programming Guide.
This example allocates a block of memory from the heap, then uses _mheap to determine which heap the block came from.
#include <stdlib.h> #include <stdio.h> #include <umalloc.h> int main(void) { char *ptr; if (NULL == (ptr = malloc(10))) { puts("Could not allocate memory block."); exit(EXIT_FAILURE); } printf("Handle of heap used is 0x%x\n", _mheap(ptr)); return 0; /**************************************************************************** The output should be similar to : Handle of heap used is 0x70000 ****************************************************************************/ }Related Information