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: 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


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