This is the mail archive of the
mailing list for the libstdc++ project.
Re: Libstdc++-v3 memory leakage?
- From: Jonathan Wakely <cow at compsoc dot man dot ac dot uk>
- To: Wu Yongwei <adah at netstd dot com>
- Cc: mingw-users <mingw-users at lists dot sourceforge dot net>, libstdc++ at gcc dot gnu dot org
- Date: Tue, 11 Mar 2003 11:04:31 +0000
- Subject: Re: Libstdc++-v3 memory leakage?
- References: <3E6D8EF1.firstname.lastname@example.org>
On Tue, Mar 11, 2003 at 03:23:29PM +0800, Wu Yongwei wrote:
> I encountered some memory leakage using "gcc version 3.2.2 (mingw
> special 20030208-1)", and I reduced it to the following simple test case:
> --- begin test.cpp ---
> #include <vector>
> #include "debug_new.h"
> using std::vector;
> int main()
> vector<int> v;
> // v.reserve(33);
> --- end test.cpp ---
> I never posted to libstdc++, and apologize for any ignorances. I
> searched for leakage in the list but did not find any relevant infomation.
The threads beginning with these messages might be relevant:
(libstdc++ people, this is being reported fairly frequently, shall I add
it to the "things that look like bugs but aren't" section of the docs?)
If you change your test program as follows:
for (int i = 0; i < 1000; ++i)
then you'll see that the memory "leaked" is constant for any number of
std::vector<int> instantiations. The memory is held in a cache that
libstdc++ re-uses. As explained in the responses to the messages given
above, this is not considered a leak since the memory is always
reachable by the library and is never lost. I think this is what your
debug code is reporting as a leak.
hope that helps,
"For a successful technology, reality must take precedence over public
relations, for Nature cannot be fooled."
- Richard P. Feynman