开发者

Checking iOS application used memory in instruments

开发者 https://www.devze.com 2023-04-08 19:33 出处:网络
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 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.

Checking iOS application used memory in instruments


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).


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消