<p>I want to be able to get an estimate of how much code &amp; static data is used by my C++ program?</p>

<p>Is there a way to find this out by looking at the executable or object files?  Or perhaps something I can do at runtime?</p>

<p>Will otool help?</p>

[{'answer_id': 35583, 'author': 'Mike Haboustak', 'author_id': 2146, 'author_profile': 'https://Stackoverflow.com/users/2146', 'pm_score': 2, 'selected': False, 'text': '<p>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"?</p>\n\n<pre><code>otool -s  __DATA __data MyApp.bundle/Contents/MacOS/MyApp\notool -s __TEXT __text MyApp.bundle/Contents/MacOS/MyApp\n</code></pre>\n\n<p>Anyway, Apple documents what gets copied into each section per-segment here: <a href="http://developer.apple.com/documentation/DeveloperTools/Conceptual/MachORuntime/Reference/reference.html#//apple_ref/doc/uid/TP40000895-CH248-95874" rel="nofollow noreferrer">Apple\'s mach-o format documentation</a></p>\n'}, {'answer_id': 35694, 'author': 'Mark Harrison', 'author_id': 116, 'author_profile': 'https://Stackoverflow.com/users/116', 'pm_score': 4, 'selected': True, 'text': '<ul>\n<li>"size" is the traditional tool and works on all unix flavors.  </li>\n<li>"otool" has a bit finer grain control and has a lot of options.</li>\n</ul>\n\n<p>.</p>\n\n<pre><code>$ size python\n__TEXT  __DATA  __OBJC  others  dec     hex\n860160  159744  0       2453504 3473408 350000\n</code></pre>\n'}]
['https://Stackoverflow.com/questions/35491', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/1841/']