This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: compiler memory use optimization
- From: "Giovanni Bajo" <rasky at develer dot com>
- To: "naje" <najeiv at ukr dot net>
- Cc: <gcc at gcc dot gnu dot org>
- Date: Thu, 18 Nov 2004 19:45:16 +0100
- Subject: Re: compiler memory use optimization
- References: <E1CUr6T-000KRL-CB@storage.ukr.net>
naje <najeiv@ukr.net> wrote:
> my program use C++ templates vary hard, so i've got much memory spent for
> compilation, and sometimes i've got "virtual memory exhaust" error.
> Is there any way to find out which part of my program is hard to
> compile to optimize it, and is there any methods to optimize memory use in
> gcc? And that kinds of optimizations of my code can i use to optimize
> compilation?
It's not easy to tell because they are mostly ineffeciencies spread across
the whole compiler. Surely we can do nothing without a preprocessed source
code to start with (and we can do nothing for 3.3 anyway -- see below).
> I use gcc3.3 on freebsd 5.2.
The good news is that 3.4 is much better at this on many testcases.
(Un)luckily, it is also much more ISO/ANSI C++ standard compliant, so
upgrading from 3.3 to 3.4 for a large C++ applications could be non-trivial.
I suggest you to try it anyway. You can consult
http://gcc.gnu.org/gcc-3.4/change.html, which contains the most common
problems found when upgrading to 3.4, with examples. After you upgraded, get
back to us and tell us how it behaves. Another good point in upgrading is
that if the problem is still reproducible with 3.4, you can submit a bug
report and we'll look into it. 3.3 is near to dead at this point, so major
work to improve compile time or memory occupaiton is very unlikely on that
branch.
--
Giovanni Bajo