31

I am getting some memory warning in my iOS app so I am running Instruments to see the allocations. Should I look at the * All Allocations * Live Bytes or Overall Bytes?

Someone said the iOS can close my app if I use for 22MB, is that from the Live or Overall bytes section?

enter image description here

Nic Hubbard
  • 41,587
  • 63
  • 251
  • 412
  • "Someone said the iOS can close my app if I use for 22MB" -- can you rephrase? – Shaggy Frog Sep 27 '11 at 20:01
  • Sorry, in this post: http://stackoverflow.com/questions/4167720/memory-used-by-any-iphone-app It mentions that if your app is using over 22MB than the OS might kill your app. – Nic Hubbard Sep 27 '11 at 20:12
  • 2
    There's no real hard and fast rule -- at least, nothing published, really. Different devices have different amounts of memory running different versions of iOS; there's no guarantee that an upper limit on your iPad running 4.3 isn't going to be well within bounds on an iPad 2 running 5.0. As always, identify exactly what devices and what versions of iOS your app needs to target, and use the most constrained device to act as your canary in the memory mine. – Shaggy Frog Sep 27 '11 at 21:32
  • 1
    is "Persistent Bytes" the new equivalent for "Live Bytes" ? – zonabi Jun 24 '15 at 19:57

1 Answers1

48

Live Bytes is the current usage and is what you are interested in, overall bytes includes all released allocation. The other thing is to look at the graph and look for peaks. As an example I saw a huge peak of about 27MB in an app I was working on, knowing that I was able to reduce peak memory usage to 8MB.

Also watch over time as you exercise your app, it is possible to have substantial memory growth over time that is not leaked, just not not used anymore.

For a description of the memory columns see Explanation of Live Bytes & Overall Bytes.

Community
  • 1
  • 1
zaph
  • 111,848
  • 21
  • 189
  • 228
  • Is there a point at which a view is released when too much memory is being used? My app is releasing my view when my live bytes are a little over 10MB. – Nic Hubbard Sep 27 '11 at 20:17
  • 3
    I see figures like that without any problems. If you see a spike on a transition you might see what can be done. There are a few tricks with autorelease pools that can be played in those instances when you get a large autoreleased object returned to you. The best is to test on small memory devices, iPodTouches, iPad1, iPhone 3GS, etc. Get a bunch of things going, sent email to the device, play netflix, etc. – zaph Sep 27 '11 at 20:55
  • From the Xcode 4.5 (ie, post-ARMv6) perspective, the iPad 1 is the new still-supported device with the lowest amount of RAM proportional to the amount of storage that views are going to eat up. Both it and the 3GS have 256mb of RAM but the 3GS has less than a fifth as many pixels. It's therefore the new best thing to test on for memory stresses. – Tommy Oct 01 '12 at 21:03
  • Tools for debugging live bytes? I'm running a Cocos2D game, it's paused and live bytes keeps climbing. – quantumpotato Jul 04 '14 at 22:08