multimap.clear() does not free its memory

Toon Knapen toon.knapen@fft.be
Fri Apr 8 12:57:00 GMT 2005


Brian Budge wrote:
> The default allocator for the standard library (STL) stuff is
> implementation dependent.  That means it won't necessarily use the
> same memory pool as operator new.  Moreover, even within any given
> pool, depending on the implementation, the implementor might decide to
> allocate memory for different scenarios.
> 
> You'd probably have reasonable luck
> allocating/deleting/allocating/deleting with operator new and/or the
> stl's allocator, but not necessarily when you mix the two.

But my problem now is that in some application I'm creating a 
'temporary' std::multimap which takes about 500MB. But now I want to 
make sure the application is going to reuse this memory later during the 
lifetime of the app (but not necessarily for stl objects) because 
otherwise it might run out of memory.

toon



More information about the Gcc-help mailing list