This is gcc 4.4.6 on Linux.
Here's the behavior
bizarre.c
double a[500000000];
main() {
}
If I compile this using:
gcc bizarre.c
Then the compiler uses 4G of memory, and takes a long time.
If I make the array size 50000000, the the compilation takes considerably less memory and time.
It's like the compiler is executing the code that it's compiling.
I realize that creating a humongous array this way might not be best practice, but any explanations?
It's a known linker bug related to --build-id, now fixed on mainline. See http://sourceware.org/bugzilla/show_bug.cgi?id=12451 Some distros took an earlier patch of Nick's that needlessly calculated a checksum over .bss, requiring the .bss section to be allocated and zeroed. Complain to your distro.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With