Heap Monitoring

Mark Vander Voord mvandervoord at gmail.com
Mon Mar 13 19:29:48 UTC 2006

After reading the different ways of getting a rough estimate of the C
heap on the Wiki, I'm left wondering why noone has suggested the
following.  Is there something dangerous or incorrect about this?

float heap_percent = 0.0f;
Heap_Control heap_ctrl;
Heap_Information_block heap_info_blk;
_Heap_Get_information(&heap_ctrl, &heap_info_blk)) {
    heap_percent = (100.0f * (float)heap_info_blk.used_size /
(float)(heap_info_blk.used_size + heap_info_blk.free_size));

Mark S VanderVoord

More information about the users mailing list