如何了解xcode调试中的CPU和内存消耗 [英] How to understand CPU and memory consumption in xcode debug

查看:927
本文介绍了如何了解xcode调试中的CPU和内存消耗的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Xcode 5中,有一个新的调试面板,以%和MB分别显示CPU和内存消耗。我们如何利用这个?我应该尝试保持低于CPU%阈值吗?有时我会看到我的应用程序达到100%或以上的程度。这是否意味着我在我的应用程序中进行了过多的处理,应该尝试进行优化?

In Xcode 5, there's a new debug panel that shows the CPU and memory consumption in % and MB respectively. How do we make use of this? Is there a CPU % threshold I should try to stay below? I sometimes see my apps goes to 100% or over.. does that mean I am doing too much processing in my app and should try to optimize?

有什么建议吗?

(PS。我在iOS上开发)

(PS. I'm developing on iOS)

推荐答案

现代iPhone或iPad具有1024Mb内存。
但是,苹果从未透露过多少可用于应用程序的东西。
只需使用尽可能少的内存,并在操作系统通知您的应用有关内存不足的情况时释放不必要的内存。

A modern iPhone or iPad has 1024Mb memory. But how much of that is available for apps is something that Apple has never divulged. Just use as little memory as possible, and release non essential memory when the OS notifies your app about low memory.

同样,请使用尽可能少的CPU ,但更重要的是,请勿阻止UI线程。
使用探查器查找CPU使用的热点并尝试对其进行优化。

Similarly, use as little CPU as possible, but more importantly, do not block the UI thread. Use the profiler to find hot spots for CPU use and try to optimize those.

这篇关于如何了解xcode调试中的CPU和内存消耗的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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