Get the PID of an executable application

During debugging on Xcode, I wanted to learn how to get the PID of the current debugged application, from this example;

2012-07-02 16: 02: 02.124 appname [14995: 700]

which one is pid? I need to get a pid because I wanted to check for a memory leak using malloc_history, which requires an application pid,

I tried ff: combinations,

shell malloc_history
 app 
 appname.app
 appname[14995]
 appname[14995:700]
 14995
 14995:700
 700
0x000000 (address)

but I always get that the process does not exist in the tbe history (malloc_history cannot find the process to which you have access that has a name like "")

+5
source share
1 answer

If you are using Cocoa, you can use:

[NSProcessInfo processInfo].processIdentifier;
+1
source

All Articles