This is the mail archive of the mailing list for the GCC project.

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

Re: libstd++ Memory leak under multithreaded application ?

Benjamin Kosnik <> writes:

> I am aware of vague reports of problems with the default allocator and
> MT-safe code.  This is one of the reasons that v-3 has __USE_MALLOC
> defined. 
> put this in stl/bits/stl_config.h:
> #     define __USE_MALLOC // As the "underlying allocator"
>    (And then there were these examples proving things... well I
>    do not have a simple test-case but I guess I could take the time to
>    write one if it is desireable.)
> If this is ever to be fixed, somebody will have to have a
> testcase. Your efforts towards this end would be appreciated.
> -Benjamin

I tried to narrow down my source-code to include simple examples, but
then again it was too simple to reproduce the memory-leaks.

I find it a bit hard to debug the internals of the stl-containers
and the allocators, but maybe the memory-leaks is actually a
reference-counting problem?

If somebody comes up with some smart techniques to help out debug
reference-counting in the STL library without going through 
one million breakpoints :-) I could have another look at the problem
without spending too much time.

Anyway - I'm now using __USE_MALLOC and it does not leak memory but
the drawback is that it is really much slower now.

Bjørn Wennberg       email:
                        ms: +47 9599 2657

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