2

I want to make sure I'm reading the allocations plug in correctly. I'm testing an iPad app thats receiving memory warnings 1,2 & 3. I want to know the current used up memory from my app, which I think it has to be the "Live Bytes" column? which marks All Allocations to 2.42 MB which I think its low.

What do the other columns report? #Transitory, Overall Bytes ? Also if my app uses only 3 MB of memory can it be killed if I get a memory level 3 warning without releasing?

Thank you.

enter image description here

the Reverend
  • 12,305
  • 10
  • 66
  • 121

2 Answers2

9

Don't use the Object Allocations instrument for looking at your total memory usage. It does not display the true total memory size of your application, for reasons that I speculate about in my answer here.

Instead, pair Object Allocations with the Memory Monitor instrument, the latter of which will show the true total size of your application. I'm willing to bet that it's way larger than the 2.42 MB you're seeing in Object Allocations (for example, I had an application with 700k of memory usage according to ObjectAlloc, but its actual size was ~25 MB in memory). If you are receiving memory warnings on an iPad, your application is probably chewing up quite a bit of memory.

Object Allocations is handy for telling you what you have resident in memory, but it's not an accurate indicator of the size of those items. It's also a great tool for showing you steady increases in allocated objects by using the heap shot functionality (the "Mark Heap" button on the left-hand side of the instrument).

Community
  • 1
  • 1
Brad Larson
  • 170,088
  • 45
  • 397
  • 571
0

Your memory usage looks fine. Check to see which app is being sent the memory warnings, it is probably not your app assuming your app is not in the background. The only way you should be getting memory warnings is if the app is in the background and another app needs more memory.

When I was looking at logs I noticed other apps were getting them while my app was running, other apps such as Mail or navigation apps (Navigon) do run in the background and will cause memory pressure. You might get a memory warning but should not be terminated.

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

As @Brad points out use the memory monitor tool as well.

Community
  • 1
  • 1
zaph
  • 111,848
  • 21
  • 189
  • 228
  • How do you check if its another app getting the warnings? Currently Iam checking the didReceiveMemoryWarning on my view controller. Thanks – the Reverend Sep 27 '11 at 18:12
  • 1
    As I point out in my answer, Object Allocations should not be used to determine the absolute in-memory size of your application. It hides a large amount of memory consumption, so we can't know anything about the true size of his application from the information provided above. I've had an application show 700k of memory usage in Allocations, when it was really using over 25 MB of memory. – Brad Larson Sep 27 '11 at 20:17