Libstdc++-v3 memory leakage?
Matt Austern
austern@apple.com
Wed Mar 12 18:46:00 GMT 2003
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
More information about the Libstdc++
mailing list