Compiler uses a lot of memory for large initialized arrays

Mark Mitchell mark@codesourcery.com
Thu Dec 2 18:23:00 GMT 2004


Joe Buck wrote:

> If we successfully reach the end of the initializer without anything evil
> like the above case, then append the temp file to the assembly output.
> Otherwise, go back and do it in memory.

I can't fathom why we are considering things like this.

Like anything else, we should try to use an efficient representation, 
which we are not, at present.  We should fix that.  But why should we go 
beyond that, jumping through complicated hoops to support initialization 
of gigabytes of data?  We don't jump through these kinds of hoops to 
support compilation of functions with millions of lines of code, or 
translation units with millions of functions.

I think it's perfectly reasonable to run out of memory processing a 
truly huge array -- provided that the compiler is being sensible about 
its internal representation.

-- 
Mark Mitchell
CodeSourcery, LLC
mark@codesourcery.com
(916) 791-8304



More information about the Gcc mailing list