> Just compiled up Oscar (public key server) there. C++ software.
> Accidentally left the -g flag in the compile line. It generated a 30MB
> static library and a 13MB shared library. Wow. That's impressive. Took out
> the -g option, and it came down to ~2MB.
>> Anyone know why C++ has so much extra debugging stuff in there, compared
> to C ?
Often it's because debug info for types and such in each header is included in
the debugging information for each translation unit (object file). When you
link the final executable, it gets all of the debug info from each object
file. Thus, you could have <iostream>'s debug info a hundred times over.
There's some work that's still due to be done by someone for the GNU linker to
make it minimize the resulting debug information when they're identical,
making the single piece of debug info from one object file be used (via weak
alias equivalents) in all of the others.
This would mean you'd not only be carrying over the debug info from the code
in each of your object files, but also from all of the C++ headers they
include; or even if it's C or C++, any and all system headers also carry
information with 'em.
Web page: http://www.zen.org/~brendan/
Maintained by the ILUG website team. The aim of Linux.ie is to
support and help commercial and private users of Linux in Ireland. You can
display ILUG news in your own webpages, read backend
information to find out how. Networking services kindly provided by HEAnet, server kindly donated by
Dell. Linux is a trademark of Linus Torvalds,
used with permission. No penguins were harmed in the production or maintenance
of this highly praised website. Looking for the
Indian Linux Users' Group? Try here. If you've read all this and aren't a lawyer: you should be!