Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can Instruments be used using the command line?

Can Instruments be used as a replacement for

valgrind

If one wants to check for memory leaks using instruments can it be used from the terminal?

like image 768
some_id Avatar asked Jan 27 '11 16:01

some_id


People also ask

How to use instrument in Xcode?

Press Command-I in Xcode, select Allocations from the list and press Choose. After a moment, you'll see the Allocations instrument. It should look familiar because it looks a lot like Time Profiler. Click the record button in the top-left corner to run the app.

How to Launch Instruments from Xcode?

Launch Instruments from the Dock: Control-click the Xcode icon in the Dock, and then choose Options > Open Developer Tool > Instruments from the shortcut menu to launch Instruments.

What is Instruments on Mac?

"Instruments" is an application provided by Apple that provides a graphical user interface for the DTrace command-line tool. DTrace is a troubleshooting tool available on several Unix-like operating systems, including Mac OS X. It can log and provide statistics for many application and kernel-level operations.

What is Apple Instruments app?

Instruments is a performance-analysis and testing tool for iOS, iPadOS, watchOS, tvOS, and macOS apps.


1 Answers

Instruments has a command line interface:

$ instruments -h

Example usage:

$ instruments -t mytemplate -a myapp.app

For leaks, try the Leaks.tracetemplate. To see all available templates, use -s.

There is another executable, just called leaks. You can inspect any running application by giving leaks its PID:

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

Read more about leaks in the Apple developer reference library.

like image 170
miku Avatar answered Oct 21 '22 19:10

miku