Re: multimap.clear() does not free its memory

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Toon,

I believe you are under a misimpression regarding memory allocation, and the interaction between the running process's global free store and the OS allocation to the process (regarding Linux, but also apropos for other OS's).

If you want to limit the amount of available memory to a process, use ulimit.

If you want to relinquish memory back to the OS, you'll need to write your own memory heap handler and use some extraordinary techniques for your memory heap handler to do that.  (Other operating systems, such as Mac OS 9 or OS/2 or Amiga OS, which allow allocating a memory extant from the OS easily through an OS API, it's quite a bit easier.  But that "easier" doesn't relieve the burden of writing a good heap manager of that memory extant.  And, in this case, easier doesn't mean better.)

So when you say "multimap.clear() does not free its memory" (in Linux), the mistake you are making is assuming that the process space is consumed space.  That's assumption is not true.

Interestingly, this topic just came up recently, on 2005.Mar.22 ("Problem with delete[] in class destructor") as well.  You can check the forum archives for details.

HTH,
--Eljay


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux