This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Memory leaks?
- To: gcc@gcc.gnu.org
- Subject: Memory leaks?
- From: Tudor Hulubei <tudor.hulubei@data.ecora.com>
- Date: Tue, 31 Aug 1999 15:30:53 -0400 (EDT)
- Organization: ecora.com
- Reply-To: Tudor Hulubei <tudor.hulubei@data.ecora.com>
Hello,
I recently tried to compile a C++ library that the company I'm working
for is developing and failed miserably (when optimizing) because of
egcs-1.1.2 trying to use more than 670Mb of memory! (I added a 0.5Gb
swap partition to no avail).
I know about the FAQ entry about memory exhaustion. I attempted to
compile the code with the following flags:
-D_GNU_SOURCE -W -Wall -ansi -Wwrite-strings -Woverloaded-virtual
-Wstrict-prototypes -Wcast-align -Wcast-qual -O3 -finline-functions
-fforce-addr -fforce-mem -funroll-loops -fomit-frame-pointer
-Wno-return-type -march=pentiumpro -malign-double -malign-loops=2
-malign-functions=2 -malign-jumps=2
I have written a small memory watchdog (for which I can provide source
code if anybody is interested) and I use it to count memory leaks in
my programs (it uses the malloc hooks provided by glibc). I linked it
against cc1plus and got hundreds of memory leaks even when compiling
small files like "int main() {}" (this was with gcc-2.95.1).
The leaks seem to be mostly from obstack allocations in make_node().
My question is whether or not cc1plus deallocates everything upon exit
or leaves it there knowing that the kernel will do it anyway, because
in the latter case the leaks reported by my memory watchdog tool are
totally useless.
I would appreciate any hints.
Thank you,
Tudor
P.S. I'm running RedHat 6.0 (i386) + egcs & gcc-2.95.1.