This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
RE: Problem with allocator in a multithreaded application.
- From: lrtaylor at micron dot com
- To: <nzorn at d2 dot com>, <gcc-help at gcc dot gnu dot org>
- Date: Mon, 24 May 2004 18:12:38 -0600
- Subject: RE: Problem with allocator in a multithreaded application.
Just a shot in the dark, but did you build it with the -pthread option
(for both compiling and linking)?
Thanks,
Lyle
-----Original Message-----
From: gcc-help-owner@gcc.gnu.org [mailto:gcc-help-owner@gcc.gnu.org] On
Behalf Of Nathan Zorn
Sent: Monday, May 24, 2004 5:58 PM
To: gcc-help@gcc.gnu.org
Subject: Problem with allocator in a multithreaded application.
Maybe this should go to libstdc++, but I will try this list first. I
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