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

查看:77
本文介绍了为什么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.

推荐答案

哪个是正确的?

Which one is correct?

我的直觉是:仪器.它使用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天全站免登陆