This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: Libstdc++-v3 memory leakage?
- From: Matt Austern <austern at apple dot com>
- To: Wu Yongwei <adah at netstd dot com>
- Cc: mingw-users at lists dot sourceforge dot net, libstdc++ at gcc dot gnu dot org
- Date: Wed, 12 Mar 2003 10:46:45 -0800
- Subject: Re: Libstdc++-v3 memory leakage?
On Tuesday, March 11, 2003, at 06:14 PM, Wu Yongwei wrote:
Thanks, Luke and Jonathan. It really works.
I strongly recommend the GLIBCPP_FORCE_NEW flag be documented in a FAQ
to ease finding memory problems.
Best regards,
Wu Yongwei
--- Original Message from Luke Dunstan ---
I had a look at mingw/include/c++/3.2.2/bits/stl_alloc.h and I am sure
this leak is harmless because STL normally allocates memory in chunks
and keeps track of freed and allocated memory itself. The only problem
is that the underlying memory isn't freed when before the program
exits because it is in static variables.
This isn't a bug, it's a feature. The decision not to free memory
immediately before program exit was deliberate. Freeing the memory
would be pointless (if we're about to exit then we know the OS is about
to reclaim the memory anyway), and it would cause a performance problem
because memory that we haven't touched for a while would have to be
paged back in.
--Matt