Problem with delete[] in class destructor (with files attached!)

Eljay Love-Jensen eljay@adobe.com
Tue Mar 22 14:28:00 GMT 2005


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



More information about the Gcc-help mailing list