This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Slow/Swappy C++ compilation
- From: Tony Bryant <brd at paradise dot net dot nz>
- To: gcc at gcc dot gnu dot org
- Date: Sun, 13 Oct 2002 14:18:28 +1300
- Subject: Slow/Swappy C++ compilation
- Organization: Bryant Research & Development
I've got a relatively small C++ application here that has one global variable
of an "Everything" class.
My main.cc file is:
//-------------
#include "everything.h"
static TProgramBase Everything;
//-------------
with "everything.h" itself including everything else needed for the definition
of TEverything (which is uses templates quite heavily)
This compiles fast (<3 secs), and gcc uses less than 5Mb of RAM doing so
If I change this to:
//-------------
#include "everything.h"
class TProgramExtended
{
public:
TProgramBase EverythingButTheGirl;
};
static TProgramExtended Everything;
//--------------
This compiles as fast and with the same low memory footprint too.
However:
//-------------
#include "everything.h"
class TProgramExtended : public TProgramBase
{
public:
TProgramExtended();
};
//---------------
this takes over 160Mb of RAM to compile! About 15 seconds if it doesn't start
swapping.
That's 160Mb to compile a unit without any code emitted!
If you are wondering TProgramBase's constructor is NOT defined as inline.
BTW I'm running gcc 3.1 for sh-elf on RH7.3, -O level has no effect on this
problem.
What is going on here?
What diagnostics could I usefully run?