Gcc compile time and memory usage change as array size when source code changes

This is gcc 4.4.6 for Linux.

Here is 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 lot of time.

If I make an array size of 50,000,000, compilation takes significantly less memory and time.

He, as a compiler, executes the code that he compiles.

I understand that creating a huge array in this way may not be the best practice, but any explanation?

+5
source share
1 answer

, --build-id, mainline. . http://sourceware.org/bugzilla/show_bug.cgi?id=12451 , .bss, , .bss , .

+6

All Articles