Can Instruments可以使用命令行吗?

问题描述:

仪器可以被用作Can Instruments可以使用命令行吗?

的valgrind

替换如果想检查使用仪器可以将它从终端使用的内存泄漏?

仪器有一个命令行界面:

$ instruments -h 

实例:

$ instruments -t mytemplate -a myapp.app 

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

还有另一个可执行文件,叫做leaks。您可以通过给leaks其PID检查任何正在运行的应用:

$ 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. 

了解更多关于苹果开发者reference library泄漏。

+0

你知道这是可能的使用Instruments命令行界面启动或附加UIAutomation工具到实际iOS设备上的进程? – Casp 2011-02-10 17:12:55

对于Xcode的9,如果要分析一个iOS应用,像这样的例子命令:

instruments -t Zombies -w 'iPhone SE (11.0.1) [XXX] (Simulator)' MyApp.app 

仪器命令REF:

https://developer.apple.com/library/content/documentation/DeveloperTools/Conceptual/InstrumentsUserGuide/Recording,Pausing,andStoppingTraces.html#//apple_ref/doc/uid/TP40004652-CH12-SW3