Memory usage
Jeffrey A Law
law@upchuck.cygnus.com
Fri Apr 30 23:15:00 GMT 1999
In message < 19990405235914.C597@ostenfeld.dk >you write:
>
> Hi all !
>
> This is not a bug. But it's almost close, and I couldn't find any
> mention of this problem on the regular egcs list, and as this is the
> only egcs list I follow, I thought I'd raise the topic here.
>
> I'm working on a project using the egcs C++ compiler, with which I am
> very satisfied indeed. Only one problem: Memory comsumption !
>
> I have a <400 line C++ file, using the STL, but not at all using STL
> *much*. The most perverse type I use is a vector<vector<some_struct> >.
> There are only a few functions in the file, the largest is around 250 lines, and
> almost just a large switch() statement with less than 15 different cases.
>
> Yet, the g++ compiler consumes more than 500 MB of memory when compiling
> this with any optimization option above -O0. No warning and no debugging
> info options given.
Inlining is not always your friend. Presumably either STL or your code is
declaring a lot of inline functions and/or templates.
With templates and inlining, the size of your source is not a good indicator
of how much memory will be required to optimize the code.
jeff
More information about the Gcc-bugs
mailing list