检查 iOS 应用程序在仪器中使用的内存

发布于 2024-12-06 09:22:58 字数 311 浏览 0 评论 0原文

我想确保我正确读取分配插件。我正在测试一个 iPad 应用程序,该应用程序收到内存警告 1,2 & 3. 我想知道我的应用程序当前使用的内存,我认为它必须是“Live Bytes”列?这将所有分配标记为 2.42 MB,我认为这个值很低。

其他专栏报告什么? #Transitory,总字节数? 另外,如果我的应用程序仅使用 3 MB 内存,如果我收到内存级别 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.

enter image description here

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

不弃不离 2024-12-13 09:22:58

不要使用对象分配工具来查看总内存使用情况。它不显示应用程序的真实总内存大小,原因是我在答案中推测的此处

相反,将对象分配与内存监视器工具配对,后者将显示应用程序的真实总大小。我敢打赌,它比您在对象分配中看到的 2.42 MB 要大得多(例如,根据 ObjectAlloc,我有一个应用程序使用了 700k 内存,但其实际内存大小约为 25 MB)。如果您在 iPad 上收到内存警告,则您的应用程序可能消耗了大量内存。

对象分配可以很方便地告诉您内存中驻留的内容,但它并不能准确指示这些项目的大小。它也是一个很好的工具,可以通过使用堆快照功能(仪器左侧的“标记堆”按钮)向您显示分配对象的稳定增长。

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

小女人ら 2024-12-13 09:22:58

您的内存使用情况看起来不错。检查哪个应用程序正在向哪个应用程序发送内存警告,假设您的应用程序不在后台,它可能不是您的应用程序。您收到内存警告的唯一方法是应用程序在后台运行并且另一个应用程序需要更多内存。

当我查看日志时,我注意到其他应用程序在我的应用程序运行时获取它们,其他应用程序(例如邮件或导航应用程序(Navigon))确实在后台运行,并会导致内存压力。您可能会收到内存警告,但不应被终止。

有关内存列的说明,请参阅实时字节说明&总字节数

正如@Brad 指出的那样,也可以使用内存监视器工具。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文