Compiler uses a lot of memory for large initialized arrays

Giovanni Bajo rasky@develer.com
Thu Dec 2 17:33:00 GMT 2004


Ian Lance Taylor <ian@wasabisystems.com> wrote:

> A customer just handed me a test case in which the compiler uses way
> too much memory when compiling a large array initialization.  This
> turns out to be PR 12245, which previously didn't have a test case
> attached to it.


Check also PR 14179, which is the same issue for C++. The testcase has 4
millions of initializers. We have almost fixed that testcase (that is: we do
much better than a few months ago), and I have been meaning to post the
final patch (to process_init_constructor) for a long time now. With that
patch on, we can compile the testcase with about 220Mb of RAM.

There are other optimizations that can be done here and there. For instance,
the CONSTRUCTOR_ELTS could be using Nathan's Vec where fesable, instead of
TREE_LISTs.
-- 
Giovanni Bajo



More information about the Gcc mailing list