Skip to main content
gamedev.net
🔒 Locked

Analysing Code Bloat

Started by Kylotan 4 replies 500+ views
Original Post
Kylotan
Kylotan
Ok, so one of my applications is now 1.7mb in debug build, even linking to the DLL version of the runtime libraries. I can''t help but think that this is a little on the large size. Are there any good ways of measuring just which classes or functions are generating this much code? (PS. I know that the code size is not as important as choosing the right algorithm or container, etc etc... but I''m just asking out of interest as much as anything.) [ MSVC Fixes | STL | SDL | Game AI | Sockets | C++ Faq Lite ]
S1CA
S1CA
Debug builds will always be bloated since they include symbol information for everything and any asserts are compiled.

Release build shouldn''t be too bloated... an example, our graphics core: GFXCORE.DLL Debug build is 521Kb, the Release build is 40Kb - quite a difference!...


If you want to see the functional bloat of your code, change the project settings to generate a mapfile (it''s in the linker options) - this creates a text file (.map extension though) which tells you the offset where each symbol is defined within your program. Because of this you also get to see any bloat introduced by the C Runtime library. [if that really concerns you, search MSDN for "TINYCRT" for an article desctibing where the CRT bloat comes from]


--
Simon O''''Connor
Creative Asylum Ltd
www.creative-asylum.com
Simon O'Connor | Technical Director (Newcastle) Lockwood Publishing | LinkedIn | Personal site
NuffSaid
NuffSaid
I could be way off here, but from my experience, using the STL and iostreams tend to increase the size of the final executable by quite a bit, even in Release mode.
==========================================In a team, you either lead, follow or GET OUT OF THE WAY.
Void
Void
One reason is possible because of classes(lots) being compiled in the local namespace.

The other is STL. Each instance of a template is compiled directly inside each .obj . Whether the linker removes duplicate entries or not is entirely up to the linker.
Kylotan
Kylotan
The only libraries I''m using is the STL and ws2_32.lib (Winsock). Release mode build is 648kb, which is still reasonably large for a MUD server

[ MSVC Fixes | STL | SDL | Game AI | Sockets | C++ Faq Lite | Boost ]

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.