Xcode Instruments的分配工具错过了很多 [英] Xcode Instruments' Allocation tool misses quite a bit

查看:159
本文介绍了Xcode Instruments的分配工具错过了很多的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的应用程序已经崩溃了很多,因为我很难理解。它不是那么多,它崩溃了 - 它被外界未知进程杀死:

My app has been crashing a lot, for reasons that I'm struggling to understand. It's not so much that it's crashing -- it's getting killed by an outside "Unknown" process:

Processes
     Name        <UUID>       rpages       recent_max       [reason]          (state)

     test-app    <....>       167111       167111     [per-process-limit] (frontmost) (resume)

我可以明白,如果我正在分配巨大的记忆块,或一个十亿个小块,但我没有做任何令人愤慨的事情。使用仪器分析告诉我,该应用程序仅使用大约8 MB,当我加载大量内容时,偶尔会高达13 MB左右。没有严重的泄漏,应用程序经常很快死亡。

I could understand that if I were allocating a huge block of memory, or a zillion smaller blocks, but I'm not doing anything that outrageous. Profiling with Instruments tells me that the app uses only around 8 MB, occasionally spiking up to 13 MB or so when I load some large content. There are no egregious leaks, and the app is often killed very quickly.

同事开始使用Activity Monitory来在模拟器中运行时检查应用程序的内存使用情况,并注意到当我们开始使用某个库时,内存从大约70 MB(我猜想模拟器有点不同)上升到800 MB。所以,我开始在模拟器中进行分析,而不是在设备上。分配工具继续报告该应用程序使用8-ish MB,但是VM Tracker会讲述另一个故事:

A colleague started using Activity Monitory to check the app's memory usage while running in the simulator and noticed that memory spiked from around 70 MB (I guess things are a little different in the simulator) to upward of 800 MB when we start using a certain library. So, I started profiling in the simulator instead of on the device. The Allocations tool continues to report that the app uses 8-ish MB, but the VM Tracker tells another story:

所以...看起来VM Tracker可以看到一些重要的内存使用分配不是。

So... it looks like VM Tracker is able to see some significant memory use that Allocations isn't.

为什么分配工具缺少该应用程序使用的内存的99%?

更新:为了回应nielsbot的问题,我仔细观察了VM Tracker的信息,发现我在分配中没有看到的最大的内存部分归功于核心动画:

Update: In response to nielsbot's question, I took a closer look at the VM Tracker's info and found that the largest part of the memory that I'm not seeing in Allocations is attributed to Core Animation:

推荐答案

我认为VM空间包括共享框架和映射内存,而分配可能不...

I think VM space includes things like shared frameworks and mapped memory whereas allocations may not...

我猜居民的大小更接近实际的金额使用RAM。纯VM内存只能映射地址空间,而不是实际的物理RAM消耗。

I guess resident size is closer to the actual amount of RAM used. Pure VM memory could just be mapped address space, not actual physical RAM consumed.

例如,看Safari,我看到1.92 GB的虚拟内存映射,但更接近549 MB的驻留,我认为是有意义的...

For example, looking at Safari, I see 1.92 GB virtual memory mapped, but closer to 549 MB resident, which I think makes sense...

这篇关于Xcode Instruments的分配工具错过了很多的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆