I'm trying to compile my C project in Ubuntu (32bit) running in VirtualBox. Compiling the code in question requires quite a bit of memory, at least 3 gig. So I gave the VM 2 gig. Along with 2 gig of swap space available, it should be enough. For some reason though gcc is failing with an out -of-memory error after it has allocated 900 meg or so. Bumping the amount of memory to 2.7 gig (the maximum allowed by VirtualBox) didn't help. There seems to be a limit on how much memory a process can use. But when I run
ulimit, it shows "unlimited".
UPDATE - Here's the make log:
libtool: compile: cc -msse2 -I. -I/home/cleong/qb -DPHP_ATOM_INC -I/home/cleong/qb/include -I/home/cleong/qb/main -I/home/cleong/qb -I/usr/include/php5 -I/usr/include/php5/main -I/usr/include/php5/TSRM -I/usr/include/php5/Zend -I/usr/include/php5/ext -I/usr/include/php5/ext/date/lib -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -DHAVE_CONFIG_H -g -O2 -c /home/cleong/qb/qb_interpreter_gcc.c -fPIC -DPIC -o .libs/qb_interpreter_gcc.o
cc1: out of memory allocating 408 bytes after a total of 924852224 bytes
make: *** [qb_interpreter_gcc.lo] Error 1
Output from /bin/time -v:
Command exited with non-zero status 2 Command being timed: "make" User time (seconds): 62.09 System time (seconds): 11.28 Percent of CPU this job got: 64% Elapsed (wall clock) time (h:mm:ss or m:ss): 1:53.02 Average shared text size (kbytes): 0 Average unshared data size (kbytes): 0 Average stack size (kbytes): 0 Average total size (kbytes): 0 Maximum resident set size (kbytes): 1848592 Average resident set size (kbytes): 0 Major (requiring I/O) page faults: 9433 Minor (reclaiming a frame) page faults: 1391779 Voluntary context switches: 5642 Involuntary context switches: 6069 Swaps: 0 File system inputs: 630360 File system outputs: 1376 Socket messages sent: 0 Socket messages received: 0 Signals delivered: 0 Page size (bytes): 4096 Exit status: 2
The version of gcc is 4.7.2.
The source code is here:
It's a PHP extension. The build process uses phpize.
UPDATE - I'm encountering the same problem in 32-bit Mageia 3, which also includes gcc 4.7.2. The failure happens at around 2.7 gig instead. In a 64-bit environment, it doesn't happen.
If I install gcc 4.6.3 and build using that, it works.