I guess I'll try to spank my heap manager to see if it's obeying me now :) !!
Nicolas.
Eljay Love-Jensen wrote:
Hi Nicolas,
why does the memory actually gets returned to the system and the heap shrinks if I use the 2nd program I sent? why does it get returned to the system when I use these 2 programs? (files attached)
You are at the mercy of the heap manager.
That behavior can vary from platform-to-platform.
is there a way for a program to yield to the system the free memory it has in the heap? (or for the system to reclaim it?)
Only if the heap manager provides a mechanism for your program to interact act with. (Any such mechanism would be non-standard.)
The general answers to the questions are: no, and no. You are at the mercy of the heap manager.
HTH, --Eljay