Mac OS X:估计代码和代码的最佳方法是什么? 程序的静态数据大小?
我希望能够估算出有多少代码& 我的 C++ 程序使用静态数据?
有没有办法通过查看可执行文件或目标文件来找到这个问题? 或者也许我可以在运行时做一些事情?
otool 有帮助吗?
I want to be able to get an estimate of how much code & static data is used by my C++ program?
Is there a way to find this out by looking at the executable or object files? Or perhaps something I can do at runtime?
Will otool help?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
。
.
我认为 otool 可以提供帮助。 具体来说,“otool -s {segment} {section}”应该打印出详细信息。 我不确定您是否可以在不指定部分的情况下获取有关 __DATA 或 __TEXT 的信息。 也许这些大小在 mach 标头中报告:“otool -h”?
无论如何,Apple 在这里记录了每个段复制到每个部分的内容: Apple 的 mach-o 格式文档
I think otool can help. Specifically, "otool -s {segment} {section}" should print out the details. I'm not sure if you can get information about __DATA or __TEXT without specifying a section. Maybe those sizes are reported in the mach header: "otool -h"?
Anyway, Apple documents what gets copied into each section per-segment here: Apple's mach-o format documentation