http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49351
--- Comment #9 from Mike Jarvis <michael at jarvis dot net> 2011-06-10 21:47:37 UTC --- That worked. So I guess g++ is exceeding the stack limit and crashing, not the heap memory. $ ulimit -aH core file size (blocks, -c) 0 data seg size (kbytes, -d) unlimited file size (blocks, -f) unlimited max locked memory (kbytes, -l) unlimited max memory size (kbytes, -m) unlimited open files (-n) unlimited pipe size (512 bytes, -p) 1 stack size (kbytes, -s) 65532 cpu time (seconds, -t) unlimited max user processes (-u) 532 virtual memory (kbytes, -v) unlimited $ ulimit -s 65532 $ ulimit -a core file size (blocks, -c) 0 data seg size (kbytes, -d) unlimited file size (blocks, -f) unlimited max locked memory (kbytes, -l) unlimited max memory size (kbytes, -m) unlimited open files (-n) 256 pipe size (512 bytes, -p) 1 stack size (kbytes, -s) 65532 cpu time (seconds, -t) unlimited max user processes (-u) 266 virtual memory (kbytes, -v) unlimited $ g++-4 -c TMV_TestSmallMatrixArith_6f.ii $ I guess this is still a bug, so I won't close it. But I don't know how easy it would be for gcc to tell when it is going to exceed the stack limit and modify behavior accordingly. Or at least to give a useful error message that the stack size needs to be increased. But regardless, thank you for your help in diagnosing the problem. (And yes, it did end up using close to 4 GB.)