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

查看:86
本文介绍了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)

我可以理解,如果我分配了一块巨大的内存块,或者是分配了成千上万个较小的块,但我所做的一切都不是那么离谱.使用Instruments进行分析告诉我,该应用程序仅使用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位数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%的内存?

更新:针对尼尔斯伯特的问题,我仔细查看了VM Tracker的信息,发现我在分配"中未看到的最大内存部分归因于Core Animation :

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&amp;#39;分配工具错过了很多的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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