Mac OS X: What is the best way to estimate code size and static data in a program?

I want to get an estimate of how much code and static data is used by my C ++ program?

Is there a way to find out by looking at executable or object files? Or something I can do at runtime?

Will otool help?

+3
source share
2 answers
  • "size" is a traditional tool and works in all unix styles.
  • "otool" has a slightly finer grain control and has many options.

.

$ size python
__TEXT  __DATA  __OBJC  others  dec     hex
860160  159744  0       2453504 3473408 350000
+8
source

, otool . , "otool -s {segment} {section}" . , __DATA __TEXT . , : "otool -h"?

otool -s  __DATA __data MyApp.bundle/Contents/MacOS/MyApp
otool -s __TEXT __text MyApp.bundle/Contents/MacOS/MyApp

, Apple , : Apple mach-o

+2

Source: https://habr.com/ru/post/1696597/


All Articles