_dump_heap_info Function

Displays the current use/free state of the heap.

Include

None

Prototype

void _dump_heap_info();

Argument

None

Remarks

This helper function can be used to profile memory allocation in the heap. It is useful for memory allocation functions.

Default Behavior

This function prints information about the heap to stderr. Information includes the memory region where heap is located, the different sections of the heap, whether a section is currently busy or free, and a summary of how much heap is free.

For example, below, a heap of 1000 has been allocated. The heap begins and ends at d0c and 10f4, respectively. The malloc function has been executed 3 different times, resulting in 3 different sections of BUSY memory and 1 FREE memory section of heap that has not been used. If the free function were to be used on any of these 3 allocated sections, the status would turn from BUSY to FREE as well.

*** Unused Heap status:
***   start: 0x00000d0c   end: 0x000010f4
***   0d0c     8 BUSY
***   0d14    16 BUSY
***   0d24    20 BUSY
***   0d38   956 FREE
***   44 used, 956 free, 010f0 end

File

_dump_heap_info.c