HCdev
HCdev

Reputation: 550

iOS App Memory profiling

I've got an issue with my iOS app getting exponentially slower to respond to tap gestures.

It's an alphabet game so cycles through a list of 26 pictures.

Using instruments, it looks like the memory footprint is healty at ~6-7 Mb:

Instruments allocations

Update: Here is a shot of my running app in profiler.. it looks hungry - real memory usage (blue line) in the 300 - 500 Mb range..

enter image description here

I've not profiled before and find the Instruments app quite unintuitive. Can someone give me a high level pointer to get me started on narrowing this down?

Upvotes: 3

Views: 4951

Answers (2)

Rob
Rob

Reputation: 438437

A couple of thoughts:

  1. I'd suggest watching WWDC 2012 video, Learning Instruments.

  2. The WWDC 2010 video, Advanced Memory Analysis with Instuments might focus more just on memory. There might be superficial UI changes in Instruments over the last few years that it doesn't reflect, but the concepts and ideas are still applicable.

  3. The use of zombies is wonderful for finding over released items where you might have dangling pointers. This is incredibly useful in manual reference counting (MRC, i.e. you have ARC turned off), but of less value in automatic reference counting (ARC) world. It achieves this by keeping track of "released" memory. But it actually consumes memory to achieve this. I'd suggest turning off zombies once you have resolved your over-release problem, otherwise you'll see memory not be returned to the app as quickly as you otherwise would have.

  4. Especially if you are not using ARC, check out the static analyzer (press shift+command+B or choose "Analyze" on the "Product" menu). This identifies many routine memory management mistakes.

Upvotes: 4

Alejandro Benito-Santos
Alejandro Benito-Santos

Reputation: 2069

You need to turn off NSZombieEnabled.

Go to your scheme, and in the run configuration go to Diagnostics and make sure Enable Zombie Objects box is unchecked.

Upvotes: 0

Related Questions