为什么 Xcode 会显示比 Instruments for SceneKit 应用程序更多的内存使用? [英] Why would Xcode show MUCH more memory use than Instruments for SceneKit app?

查看:32
本文介绍了为什么 Xcode 会显示比 Instruments for SceneKit 应用程序更多的内存使用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试调试为什么我们的基于 SceneKit 的应用程序使用了如此多的内存,但 Xcode 和 Instruments/Allocations 对于所使用的内存量似乎有非常不同的值.当我查看 Xcode 时,我看到类似 600 MB 的内容,但是当我将相同的运行会话转移到 Instruments/Allocations 时,我看到了一个非常不同的持久字节数,例如 150 MB.

I'm trying to debug why our SceneKit-based app is using so much memory but Xcode and Instruments / Allocations seem to have very different values for the amount of memory being used. When I look in Xcode I see something like 600 MB but when I transfer the same running session over to Instruments / Allocations, I see a very different number for persistent bytes, like 150 MB.

哪个是正确的?为什么会有差异?他们衡量的是不同的东西吗?

Which one is correct? Why the difference? Are they measuring different things?

(无论我是转移 Xcode 调试会话还是在 Instruments 中重新开始,似乎都没有太大区别.)

(Regardless of whether I Transfer an Xcode debug session or start fresh in Instruments, it doesn't seem to make much difference.)

我关心的原因是 iOS 因过度使用内存而终止应用程序(根据 Xcode),但我似乎无法通过 Instruments 找到问题.

The reason that I care is that iOS is killing the app for excessive memory use (according to Xcode) but I can't seem to find the problem via Instruments.

我已经尝试关闭所有 GPU 和 Metal 调试选项,但它们似乎没有任何区别.

I've tried turning off all GPU and Metal debug options but they don't seem to make a difference.

推荐答案

哪个是正确的?

我的直觉是:仪器.它使用 Dtrace 来(抱歉)检测您的代码并在实际分配和释放发生时观察它们,以牺牲性能为代价.Xcode 调试导航器内存图更像是一个外部视图,旨在提供对正在发生的事情的非常一般的了解.这正是后者为您提供了一种切换到前者的方法的原因——因为那(仪器)是您获得真实测量值的地方.

My intuition is: Instruments. It uses Dtrace to (sorry) instrument your code and watch actual allocations and deallocations as they happen, at the expense of performance. The Xcode debug navigator memory graph is more of an outside view designed to give a very general sense of what’s happening. That is exactly why the latter offers you a way to switch to the former — because that (Instruments) is where you’re going to get real measurements.

(但是,请记住,Instruments 可能无法包含在您看到的一些用于图形的虚拟内存后备存储的总数中.有很多 WWDC 视频更详细地讨论了这个主题.)

(However, let’s keep in mind that Instruments may fail to include in the total you’re seeing some virtual memory backing stores for graphics. There are plenty of WWDC videos discussing this topic in more detail. )

这篇关于为什么 Xcode 会显示比 Instruments for SceneKit 应用程序更多的内存使用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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