L
Legrandin
Hi
I run into a quite weird problem yesterday.
I've got a complex class (let's call it A) which is the last branch of a
deep tree. It has several virtual methods. In a separate module I define a
hundred of different sibling classes, all inherited from A and each one
having just a constructor and a few one-liners, mainly for re-cast. They
don't override any virtual method.
Well, when I compile the new module I get a *huge* object file
(fair) but even with a static linking the final application is huge as
well.
What's in that object file? I know that polymorphism adds a virtual
table to each class, but here I've got several hundreds Kbytes of
overhead for one hundred classes. Isn't it too much? What does the
compiler do?
BTW, what's a good profiler targeted at minimization of code size?
PS: I use gnu g++ and yes, everything is stripped out and I optimize for
size.
I run into a quite weird problem yesterday.
I've got a complex class (let's call it A) which is the last branch of a
deep tree. It has several virtual methods. In a separate module I define a
hundred of different sibling classes, all inherited from A and each one
having just a constructor and a few one-liners, mainly for re-cast. They
don't override any virtual method.
Well, when I compile the new module I get a *huge* object file
(fair) but even with a static linking the final application is huge as
well.
What's in that object file? I know that polymorphism adds a virtual
table to each class, but here I've got several hundreds Kbytes of
overhead for one hundred classes. Isn't it too much? What does the
compiler do?
BTW, what's a good profiler targeted at minimization of code size?
PS: I use gnu g++ and yes, everything is stripped out and I optimize for
size.