Sunday, August 15, 2004

Pushing the compiler's limits

As a programmer, some of the compiled binaries are larger than 300MB. This begins to cause problems for GDB which runs out of virtual address space on 32-bit machines. For fun, I wanted to start seeing how large a binary I could make. This seemed like a good enough excuse to get an Opteron machine with its larger virtual address space.

Fedora Core 2 is the first stable SMP AMD64 platform. It comes with gcc 3.3.3. In my first test, I created a simple python script which outputs:

void a0();

void a1();

int main() {
a0();
a1();
return 0;
}

void a0() {
}
void a1() {
}


I generated C source files which started with one function up to 100,000 functions. The next order of magnitude caused gcc to crash when it was run without any options. When optimizing, gcc crashes at 100,000.

In terms of file sizes:









FunctionsPlainDebugOptimize
1682979256821
10756192657609
100151542317015058
10009165516447190631
100008656561604480855672
100000869565716474481n/a


Next time, the quest for the big binary continues by using more source files. And later, we'll try dynamic and static linking.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home