This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: Memory usage
- To: jakob at ostenfeld dot dk
- Subject: Re: Memory usage
- From: Jeffrey A Law <law at upchuck dot cygnus dot com>
- Date: Fri, 09 Apr 1999 00:56:19 -0600
- cc: egcs-bugs at egcs dot cygnus dot com
- Reply-To: law at cygnus dot com
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