应用程序运行时检查内存使用情况 [英] Checking Memory Usage While Application is Running
问题描述
在运行我的应用程序时,我有时会收到内存警告。它并不总是发生在代码中的相同位置,但我怀疑它与从我的应用程序外部分配的内存有关;即如果后台iPhone上运行的应用程序很多,我会提前收到内存警告,如果没有应用程序在后台运行,我根本就不会收到警告。
While running my app, I sometimes get Memory Warning. It doesn't always happen in same place in the code, but I suspect it has something to do with memory allocated from outside of my app; i.e. if there are many applications running on the iPhone in the background I will get the memory warning earlier, and if there are no applications running in the background I will not get the warning at all.
- 我可以使用一种方法来检查我的应用程序在某一点上使用了多少内存吗?
- 有没有一种方法可以用于检查机器(iPhone / iPad)在某一点上使用了多少内存?甚至可以检查还有多少内存可供使用?
- 一般来说,也许有人知道在哪里可以找到有关不同iOS机器的内存限制的数据?
谢谢,
Ohad
Thanks, Ohad
推荐答案
使用乐器
,您可以查看应用程序使用的内存量。
在Xcode4中,使用Profile构建,选择 Leaks
,然后单击工具栏中的Library按钮并添加 Memory Monitor
instrument。
Using Instruments
you can check how much memory your app is using.
In Xcode4, use 'Profile' build, choose Leaks
, then click the Library button in the toolbar and add the Memory Monitor
instrument.
它将显示正在运行的每个应用程序的概述以及每个应用程序使用的内存量。
It will show an overview of every app that is running and how much memory each is using.
这篇关于应用程序运行时检查内存使用情况的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!