分析DLL / LIB Bloat [英] Profiling DLL/LIB Bloat

查看:110
本文介绍了分析DLL / LIB Bloat的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在VS2005中继承了一个相当大的C ++项目,它编译成大约5MB的DLL。我想减少图书馆的大小,因此通过网络加载更快的客户,他们使用缓慢的网络份额。



我知道如何做这通过分析代码,包括和项目设置,但我想知道是否有任何可用的工具,可以更容易地确定代码的哪些部分占用最多的空间。有没有办法生成DLL布局的配置文件?一个关于图书馆图像消费空间的报告以及多少?

解决方案

构建DLL时,可以通过<链接器的href =http://msdn.microsoft.com/en-us/library/k7xkk3e2.aspx =noreferrer> / MAP 使其生成包含地址的地图文件所得图像中的所有符号。您可能需要做一些脚本来计算每个符号的大小。



使用strings实用程序扫描您的DLL可能会显示意外或未使用的可打印字符串(例如资源,RCS ID, __ FILE __ 宏,调试消息,断言等)。



另外,如果你还没有使用 / Os 启用,值得一试。


I've inherited a fairly large C++ project in VS2005 which compiles to a DLL of about 5MB. I'd like to cut down the size of the library so it loads faster over the network for clients who use it from a slow network share.

I know how to do this by analyzing the code, includes, and project settings, but I'm wondering if there are any tools available which could make it easier to pinpoint what parts of the code are consuming the most space. Is there any way to generate a "profile" of the DLL layout? A report of what is consuming space in the library image and how much?

解决方案

When you build your DLL, you can pass /MAP to the linker to have it generate a map file containing the addresses of all symbols in the resulting image. You will probably have to do some scripting to calculate the size of each symbol.

Using a "strings" utility to scan your DLL might reveal unexpected or unused printable strings (e.g. resources, RCS IDs, __FILE__ macros, debugging messages, assertions, etc.).

Also, if you're not already compiling with /Os enabled, it's worth a try.

这篇关于分析DLL / LIB Bloat的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆