Xcode 5 Debug Gauges To Monitor Memory and CPU Usage

I’m sure you’ve noticed the innocuous little reference to CPU and Memory utiltization in Xcode 5 when running a project:

Xcode debug gauge

Found a little gem today when I inadvertently clicked on the memory gauge, Xcode responded with the following (which was shown in the right pane of Xcode):

Xcode debug memory gauge

Well that was a pleasant surprise. Taking another step further I chose the option to Profile in Instruments (option in upper right corner). At this point two options were presented. First, to transfer the active debug session to Instruments without stopping the current session. Second, I could kill the current session and launch a new session in Instruments.

As you would expect, you get a similar dialog when clicking the CPU gauge.

Interesting what one can find simply poking around.

  1. There’s also some useful GPU info (frames per second and GPU utilisation) – very useful if you’re doing anything graphics/game related.

    Speaking of which, beware of trusting the memory gauge. It’s useful, but it doesn’t tell the whole story:

    – It doesn’t include OpenGL textures. If you’re using OpenGL you’re using a lot more than the gauge says (and if you leak textures you’re in big trouble ;)

    – It doesn’t include frameworks too. Not normally an issue since they’re shared between apps, but if you don’t support 64bit, when your app runs on a 64bit device it forces the OS to load 32 bit versions of the frameworks. That eats a big chunk of extra RAM you’re probably not anticipating. (64bit apps use more RAM, but after taking the framework issue into account 32bit apps on a 64bit device are usually worse!)

    – It doesn’t include system services your app uses. Typical example: if your app saves a photo, the media server daemon uses a big chunk of RAM to process and save the image.

Comments are closed.