Passing 250 or so files from a larger software project (about 3MB of 
sourcecode) to gcc at a time makes gcc use more than 400MB of memory. Possible 
more as I had to stop the compilation.

I created a much simpler example. 100 equal .c files each containing:

static void mainX() {}

where X varies from 1 to 10000. This gives me a slightly different behaviour. 
Compiling only one of the files consumes about 60MB memory. Compiling all of 
the 100 files consumes up to 142MB of memory. Then gcc crashes.

If I'm understanding how gcc compiles multiple files at the same time 
correctly, then gcc should release most of the memory used for compiling one 
file before it begins compiling the next. Is this correct? If so, then I would 
expect overall memory usage during compilation of the 100 equal .c files to be 
not much more than 60MB.


Reading specs from C:/MinGW/bin/../lib/gcc/mingw32/3.4.2/specs
Configured with: ../gcc/configure --with-gcc --with-gnu-ld --with-gnu-as --host=
mingw32 --target=mingw32 --prefix=/mingw --enable-threads --disable-nls --enable
-languages=c,c++,f77,ada,objc,java --disable-win32-registry --disable-shared --e
nable-sjlj-exceptions --enable-libgcj --disable-java-awt --without-x --enable-ja
va-gc=boehm --disable-libgcj-debug --enable-interpreter --enable-hash-synchroniz
ation --enable-libstdcxx-debug
Thread model: win32
gcc version 3.4.2 (mingw-special)

Let me know if you need more information.

-- 
           Summary: High memory usage when compiling multiple files at a
                    time
           Product: gcc
           Version: 3.4.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: ch at csh-consult dot dk
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: i386-pc-mingw32
  GCC host triplet: i386-pc-mingw32
GCC target triplet: i386-pc-mingw32


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19513

Reply via email to