When compiling a 5 MB C file with 65337 functions, gcc takes over 700 MB of ram compiling the file to assembly. Files with fewer functions (32769 and 16385) take exponentially less time. A workaround is to split the file into multiple c files and compile into intermediate files seperately.
tinycc aka tcc takes 0.5 seconds to compile the same file. I'd be happy to provide more information and justifications for such a large number of functions, but I assume that the bug can be fixed without it. -- Summary: GCC uses a lot of RAM when compiling a large numbers of functions Product: gcc Version: 4.3.4 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: jvoss at altsci dot com GCC host triplet: x86_64-pc-linux-gnu GCC target triplet: x86_64-pc-linux-gnu http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44563