iPhone内存警告级别= 2 [英] iPhone Memory warning level=2

查看:86
本文介绍了iPhone内存警告级别= 2的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个应用程序,可以在彼此之间叠加大量视图.

I have an app that stacks quite a nice amount of views on top of each other.

有时我会收到内存警告"级别2(这是预料之中的).

At some point I receive a Memory warning level2 (which is kind of expected).

问题是,当我运行Instruments时,我没有任何内存泄漏,并且该应用占用了大约9-10MB的内存...这不是那么,我会说?

The thing is, when I run Instruments, I don't have any memory leaks and the app takes up something like 9-10MBs... which is not that much, I'd say?

问题是:一个应用可以消耗多少内存,也就是iPhone有多少RAM?

Question is: how much memory can an app consume, a.k.a. how much RAM does the iPhone have?

我知道我可以响应接收到的MemoryWarning并释放一些内存-但这意味着我必须摆脱一些视图,这不是我正在寻找的解决方案...

I know that I can respond the the receivedMemoryWarning and free up some memory - but this would mean that I'd have to get rid of some of the views, which is not the solution I'm looking for...

该应用到目前为止还没有崩溃-但我担心它可能会在其他用户的iPhone上崩溃...

The app didn't crash so far - but I'm concerned that it might crash on other user's iPhones...

推荐答案

应用程序可以使用30-40 MB的实际内存或更大的内存,这将不会有问题.当您收到内存警告级别1之前,直到那时都没有问题,但是如果您收到内存警告级别2,则该应用程序可能会或将在一段时间后崩溃.

An application can use 30-40 MB of real memory or greater then this and there will not be a problem. When you are getting a memory warning level-1, till then there is not a problem, but if you get memory warning level-2, then the app might or will crash after some time.

解决方案是,当您收到2级内存警告时,在您的委托方法内部,释放一些您当前未使用的内存.

solution is, when you get memory warning level-2, inside your delegate method, release some memory which you are not using currently.

这篇关于iPhone内存警告级别= 2的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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