This is the mail archive of the
mailing list for the libstdc++ project.
Re: stl / pthreads leak, patch
I am well aware of the true definition of a "memory leak". The program I
am working on (forget the sample) shows that I always have a pointer to
memory that the stl allocator allocated.
The problem is either that 1) the "cache" grows larger and larger
without a limit, or 2) the stl looses track of something and does not
perform enough frees for each alloc. The reporting I get from Valgring
seems to support #2.
In any case, it does not look like the stl is thread-safe for
applications that 1) are suppose to run "forever", 2) make heavy use of
the stl, and 3) make heavy use of pthreads.
I know several others have reported this bug. Maybe someone, someday
will fix it. Until then, I have no other choice but to abandon the stl
when using pthreads.
BTW. Can someone answer this? When using the _USE_MALLOC flag on older
versions of GCC, Valgrind reported no unfreed memory that I had a
pointer to (call it whatever you please) AND also reported no leaks. The
trouble was that is significantly reduced performance, while memory
usage soared without limit until program exit. This whole situation
makes me suspicious.