Size of executables

Why are my executables so LARGE? I can’t believe that the STL and
inlining a few methods can make one SMALL program into a 419584 byte
executable. The program itself contains only about 1200 lines of code!

I’m using QCC and the docs say that QCC links dynamically to libraries
by default. So what can it be, it GCC really this bad?

Gregor

Try adding -fno-default-inline to your compile.

Gregor Brandt <gbrandt@oerlikon.ca> wrote:

Why are my executables so LARGE? I can’t believe that the STL and
inlining a few methods can make one SMALL program into a 419584 byte
executable. The program itself contains only about 1200 lines of code!

I’m using QCC and the docs say that QCC links dynamically to libraries
by default. So what can it be, it GCC really this bad?

Gregor


cburgess@qnx.com

What does that do to the speed of the exe though?
If the slow down in minor I can handle it, if its too big, there
could be trouble.

Thanks

Gregor


Colin Burgess wrote:

Try adding -fno-default-inline to your compile.

Gregor Brandt <> gbrandt@oerlikon.ca> > wrote:

Why are my executables so LARGE? I can’t believe that the STL and
inlining a few methods can make one SMALL program into a 419584 byte
executable. The program itself contains only about 1200 lines of code!


I’m using QCC and the docs say that QCC links dynamically to libraries
by default. So what can it be, it GCC really this bad?


Gregor

Gregor Brandt <gbrandt@oerlikon.ca> wrote:

What does that do to the speed of the exe though?
If the slow down in minor I can handle it, if its too big, there
could be trouble.

It prevents C++ methods from being inlined by default. This may show a
slowdown, but you can use the explicit inline keyword where necessary.


Thanks

Gregor



Colin Burgess wrote:

Try adding -fno-default-inline to your compile.

Gregor Brandt <> gbrandt@oerlikon.ca> > wrote:

Why are my executables so LARGE? I can’t believe that the STL and
inlining a few methods can make one SMALL program into a 419584 byte
executable. The program itself contains only about 1200 lines of code!


I’m using QCC and the docs say that QCC links dynamically to libraries
by default. So what can it be, it GCC really this bad?


Gregor
\


cburgess@qnx.com

Gregor Brandt <gbrandt@oerlikon.ca> wrote:

Why are my executables so LARGE? I can’t believe that the STL and
inlining a few methods can make one SMALL program into a 419584 byte
executable. The program itself contains only about 1200 lines of code!

Hm…another thought have you compiled optimised, or with debug enabled?
That can make a difference in executable size.

Also, C++ does tend to generate large executables – 1200 lines of C++
code can invoke a lot more behaviour than 1200 lines of C code, resulting
in more executable size.

The STL is not small either.

-David

QNX Training Services
dagibbs@qnx.com