memory consumption

Jay K
Sun Jun 6 05:19:00 GMT 2010

Arg, due to memory consumption, gcc 4.3.5 cannot build itself or 4.5.0. Host compiler can build 4.3.5 but not newer due to c9x usage (I opened a bug, it appears to have gotten a lot of attention. :) )

I got further with 4.5.0 by disabling -g and -O2.

gcc -c   -g -O2 -DIN_GCC   -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition -Wmissing-format-attribute -pedantic -Wno-long-long -Wno-variadic-macros                      -Wno-overlength-strings    -DHAVE_CONFIG_H -I. -I. -I/home/jayk/src/gcc-4.3.5/gcc -I/home/jayk/src/gcc-4.3.5/gcc/. -I/home/jayk/src/gcc-4.3.5/gcc/../include -I/home/jayk/src/gcc-4.3.5/gcc/../libcpp/include -I/home/jayk/include  -I/home/jayk/src/gcc-4.3.5/gcc/../libdecnumber -I/home/jayk/src/gcc-4.3.5/gcc/../libdecnumber/dpd -I../libdecnumber    /home/jayk/src/gcc-4.3.5/gcc/c-common.c -o c-common.o

cc1: out of memory allocating 8016 bytes after a total of 132342656 bytes
make[2]: *** [c-common.o] Error 1

gcc -c   -DIN_GCC   -W -Wall -Wwrite-strings -Wcast-qual -Wstrict-prototypes -Wmissing-prototypes -Wmissing-format-attribute -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings -Wold-style-definition -Wc++-compat   -DHAVE_CONFIG_H -I. -I. -I/home/jayk/src/gcc-4.5.0/gcc -I/home/jayk/src/gcc-4.5.0/gcc/. -I/home/jayk/src/gcc-4.5.0/gcc/../include -I/home/jayk/src/gcc-4.5.0/gcc/../libcpp/include -I/home/jayk/include  -I/home/jayk/src/gcc-4.5.0/gcc/../libdecnumber -I/home/jayk/src/gcc-4.5.0/gcc/../libdecnumber/dpd -I../libdecnumber     /home/jayk/src/gcc-4.5.0/gcc/fold-const.c -o fold-const.o

cc1: out of memory allocating 8016 bytes after a total of 132359040 bytes

make[2]: *** [fold-const.o] Error 1
make[2]: Leaving directory `/home/jayk/obj/gcc45/gcc'
make[1]: *** [all-gcc] Error 2
make[1]: Leaving directory `/home/jayk/obj/gcc45'
make: *** [all] Error 2

bash-4.1$ gcc -v
Using built-in specs.
Target: alphaev67-dec-osf5.1
Configured with: /home/jayk/src/gcc-4.3.5/configure -disable-nls -prefix=/home/jayk -with-gmp=/home/jayk -disable-bootstrap
Thread model: posix
gcc version 4.3.5 (GCC) 

I've asked administrator about the memory limit.

I hit similar problems building gcc in virtual machines that I think had 256MB. I increased them to 384,

Maybe gcc should monitor its maximum memory? And add a switch -Werror-max-memory=64MB, and use that when compiling itself, at least in bootstrap with optimizations and possibly debugging disabled? Or somesuch?

I guess I can just make do with 4.3.5 built with host cc.
Maybe I'll try splitting up some of the files. Is that viable to be applied for real?

 - Jay

More information about the Gcc-help mailing list