开发者

Analyze .exe/.dll (Windows PE) files for code bloats

开发者 https://www.devze.com 2023-01-18 15:56 出处:网络
Let\'s say I have a project with a dozen of different modules which produce one resultant开发者_开发知识库 DLL, how can I analyze it so that I can identify the actual file size that each module/functi

Let's say I have a project with a dozen of different modules which produce one resultant开发者_开发知识库 DLL, how can I analyze it so that I can identify the actual file size that each module/functions contribute? I know it might be impossible with a Release build where much information has been stripped, but how about if I have the full source and can do a Debug build?

Also, if there are big static variables defined somewhere, is there a way I can easily locate them?

Bonus question: How about Linux ELF files?


Whenever I've been involved in identifying bloat I generally start with dumpbin on Windows. Usually by writing a tool to examine each object module via dumpbin then analyse the output. It tends to be an iterative process and can take a fair amount of time.

For debug builds with PDB Sizer can produce useful reports.

Adrian has some useful guidance here. Minimizing Code Bloat for Faster Builds and Smaller Executables and a tool called SymbolSort to help. The source in C# is included with SymbolSort so that may be a good place to start if SymbolSort doesn't help.

For ELF the output of nm and objdump are a good starting point.

0

精彩评论

暂无评论...
验证码 换一张
取 消