可以使用命令行使用Instruments吗?

jar*_*ryd 6 c xcode instruments

可以使用仪器作为替代品

的valgrind

如果想要使用仪器检查内存泄漏是否可以从终端使用?

mik*_*iku 16

Instruments有一个命令行界面:

$ instruments -h
Run Code Online (Sandbox Code Playgroud)

用法示例:

$ instruments -t mytemplate -a myapp.app
Run Code Online (Sandbox Code Playgroud)

对于泄漏,请尝试Leaks.tracetemplate.要查看所有可用模板,请使用-s.

还有另一个可执行文件,只需调用leaks.您可以通过提供leaksPID 来检查任何正在运行的应用程序

$ ps aux | grep "[b]ash" | awk '{print $2}'
620

$ leaks 620
leaks Report Version:  2.0 
Process:         bash [620]
Path:            /bin/bash
Load Address:    0x100000000
...
Process 620: 37983 nodes malloced for 1123 KB
Process 620: 0 leaks for 0 total leaked bytes.
Run Code Online (Sandbox Code Playgroud)

阅读Apple开发人员参考库中有关泄漏的更多信息.

  • instruments -t /Developer/Platforms/iPhoneOS.platform/Developer/Library/Instruments/PlugIns/AutomationInstrument.bundle/Contents/Resources/Automation.tracetemplate <full_path_to_application> -e UIASCRIPT <script.js> -e UIARESULTSPATH <output_results_path>发现于http://lemonjar.com/blog/?p=69 (3认同)
  • 只是进程名称也可以工作:`泄漏MobileSafari` (2认同)