What’s taking up space in your programs?
Ever wondered what takes up space in the programs you write? I certainly did on a number of occasions.
For some reason though, I could not find a decent tool that would look at a Visual Studio compiled executable or a DLL, and report an overview of how large are the functions, classes, object files and whatnot. .kkrunchy executable packer does have a very nice size report, but it’s not exactly suitable for large executables…
Anyway, ryg of farbrausch fame was kind enough to donate the size reporting code, I did some modifications, and here it is: Sizer – executable symbol size reporting utility.
Enjoy. Oh, and the source code looks messy mostly because ryg and I use different indentation, and I never cared to format everything with a single style. Noone cares about the source code anyway, as long as it works. I’m not claiming that this code works, of course!
Nice tool. I tried and it looks interesting but need to know more how STL are computed.
Following seems to be a quite more then I would expect!
Aggregated templates by size (kilobytes):
35.25 # 88: std::_Tree::erase
Ketan
This section lists templates (including, but not limited, to STL). Here it says: 35.25 kilobytes are taken by all instantiations of std::_Tree_erase, and there are 88 different instantiations in total.
Note that for each template type combination, it will only be instantiated once. More, linker can collapse template instantiations that end up being exactly the same (much like it can collapse different functions that are exactly the same). So something like std::vector::push_back() will likely end up instantiated only once for different ‘sometype’s.
That’s exacly what I have been looking for…kind of :) One of my excutables just grows by 60kb in bss when I include some Granny files, and I was wondering where specificaly it comes from. I wish it would support PS3 elfs :)
Well, BSS is kind of harmless. It’s a segment for zero-initialized data, so BSS is not actually included in the executable. It’s allocated and filled with zeroes at load time.
For PS3 SPU code bss does matter, because it’s placed into same very limited memory…
Ah, lovely SPUs. Right.
…anyway, this tool does not quite support ELF format :)
Thanks! It’s more helpful for me than Ryg’s one, since what I get from .kk is something like this:
0.00/ 12: tmp_vec ngn.obj
0.00/ 16: light_color ngn.obj
0.00/ 24: fonts texloader.obj
0.00/ 352: operator_names texloader.obj
0.00/ 13424: module music.obj
0.00/ 280: another_day_5 files.obj
I mean it sorts it in some random order and shows 0 for packed size, while Sizer does the job (in terms of uncompressed size which is pretty useful anyways). Looking forward to see more useful things from you ;)
BTW I think DebugInfo::WriteReport()::kMinXXX – can be taken from command line (you know everyone needs different scopes).
I changed them for myself, but think it could be nice for next update 8)