This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ 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: Memory NEVER freed!


On Thu, Aug 08, 2002 at 09:39:01AM +0200, Jean-Eric Cuendet wrote:
> Hi,
> I have a problem. One of my program allocate a LOT of small pieces of memory with new/delete.
> When freed, the RSS of my prog doesnt change!
> I *THINK* that the memory is freed since if I alloc again the same space,
> the RSS doesnt change. But the RSS *NEVER* come back to the level it was
> before the allocation.

You have answered your own question:  the memory is not released back to
the operating system, but is kept in a free list for subsequent requests.

This has nothing to do with the C++ library, by the way.  It is standard
behavior for malloc/free on almost every Unix variant.  Some (like Solaris)
have a mmap-using malloc implementation which may be used instead.
Some (like Linux) will use the mmap approach by default when they can.


Phil

-- 
I would therefore like to posit that computing's central challenge, viz. "How
not to make a mess of it," has /not/ been met.
                                                 - Edsger Dijkstra, 1930-2002


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