views:

1177

answers:

4

Is Activity Monitor (a.k.a. Memory Monitor) the only tool in Xcode Instruments that can measure the total app RAM usage of an iPhone app running in Simulator? Just that line showing momentary wired RAM?

And how accurate is that versus iPhone hardware, especially given OSX paging i/o to VM?

I'm seeing 7-8MB wired RAM figures for just the default Xcode iPhone project templates (other than OpenGL) compiled and running. At the same time Object Allocations shows well under 1MB for all objects.

A: 

This is a really essential question for iPhone development -- does anyone have experience with this?

Lacey
+1  A: 

Nope, there's a much better way to do it.

Go to the Run menu and select Run with Performance Tool then Object Allocations.

This will start Instruments and will show RAM usage. It's also useful for detecting memory leaks if you choose Leaks instead of Object Allocations.

David Kanarek
A: 

@David Kanarek: the original question mentions using Object Allocations, and is also discussing using Activity Monitor from within Performance Tool (= "Instruments").

I guess this question isn't getting a lot of responses as every iPhone developer is madly buried in the iPad SDK at the moment : )

Joan
A: 

I would agree, since the Simulator is just an "API simulator", the behavior you see is going to be at least somewhat dependent how OS X manages memory. And the restrictions are obviously different, for example you can exceed 128 MB of ram, or even 256 MB, which obviously isn't possible on any current iPhone or iPod Touch (at least, as of this writing...).

I've still found it useful in OpenGL for making sure textures and other items are properly deallocated, but beyond that, it's just a rough guideline.

However, if you want to see memory usage on device, there's a simple enough solution. Just target Device in Xcode, and go to Run > Run with Performance Tool > Object Allocations, then the build will be sent to the device and the Object Allocations tool will pop up next to Xcode and show on device memory usage.

Jazon