Problem with allocator in a multithreaded application.

llewelly@xmission.com llewelly@xmission.com
Thu May 27 21:13:00 GMT 2004


Nathan Zorn <nzorn@d2.com> writes:

> Maybe this should go to libstdc++, but I will try this list first.
> I

It has been a few days. Try libstdc++ or bugzilla.

> am developing a multithreaded
> application that uses a lot of the std containers and streams.  Since
> the platform  I am developing
> for is redhat 7.2 , I initially used the compiler that is shipped with
> that distribution (2.96).  This
> version had its problems, so I decided to start using gcc version
> 3.3.2 (the latest at the time).  I
> built this version with only the --enable-threads configure switch.
> I released a stable version of
> my application with this build.   Recently I switched development
> machines and attempted
> to rebuild the gcc compiler (again only with --enable-threads
> configure option).  Ever since this rebuild my application has had
> strange memory leak problems.  It will run for awhile then consume all
> the machines memory resources.  This is the same version of my code
> that ran fine before and
> the same version of gcc (only rebuilt on the new machine).  Since this
> version of gcc didn't work
> I also tried gcc 3.4.0 with the same result.  I have ran this
> application through valgrind with
> no reports of problems except in the std::allocator code.  I found
> this in the FAQ which explains that it isn't a leak but just the
> behavior of the basic allocator.  So, I created a small application
> [1] that when it is run through valgrind single threaded its fine, but
> multithreaded it definitely
> seems to leak memory.  Also in order to elliminate that it is my code,
> I built my application
> with the Intel compiler and the memory leak didn't occur, even after
> three days of running.
> 
> 
> Any suggestions and help is appreciated.  I really don't want to start
> using the intel compiler instead of gcc.
> 
> Thanks
> 
> [1] http://bfs.itlab.musc.edu/~nathan/stl_vector.C



More information about the Gcc-help mailing list