iPhone 开发 - iphone 应用程序的内存限制 [英] iPhone Development - Memory limitation for iphone application
问题描述
任何人都可以在这里指出正确的方向.我想在我的应用程序收到内存警告时做出响应(我想知道如何响应此通知).另外,我的应用程序可以连接多少内存?
Can anyone point into the right direction here. I want to respond when my application receives memory warning, (i want to know how to respond to this notification). Plus, How much memory can i wire with my application?
任何文章或书籍参考都会很棒.谢谢.
Any articles or book reference would be great. Thanks.
推荐答案
如果您的应用收到内存警告(例如在视图控制器的 didReceiveMemoryWarning
方法中),您需要释放任何非关键数据.例如,您使用的任何缓存或可以重新生成的内容都应该被转储.
If your app gets a memory warning (such as in your view controller's didReceiveMemoryWarning
method) you need to release any non-critical data. Anything that you're using that cached, for example, or that can be regenerated, should be dumped.
例如,如果您的应用程序处理一些数字并将结果存储在一个大数组中,如果您没有主动使用该数组,则应该释放它.然后,当你再次需要它时重新生成它.
For example, if your app crunches some numbers and stores the result in a big array, if you're not actively using that array, you should release it. Then, regenerate it when you need it again.
这里有更多信息:观察低内存警告
这篇关于iPhone 开发 - iphone 应用程序的内存限制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!