This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]