[英]What's exactly behind / inside iPhone memory management?
This question is NOT about retain/release things in iphone memory management. 这个问题不是关于iphone内存管理中保留/释放的东西。 I understand the routine quite well and there is no memory leak things in my app. 我非常了解这个例程,我的应用程序中没有内存泄漏的东西。
I pop up the question shown in the title, when I use Activity Instruments to monitor the overall memory activity of my app. 当我使用Activity Instruments监视我的应用程序的整体内存活动时,我会弹出标题中显示的问题。
The instrument always shows that the amount of "real memory", which my app is using, keeps being between 21 MB and 30MB, never higher. 该仪器始终显示我的应用程序正在使用的“真实内存”量保持在21 MB到30 MB之间,从不高。 I think this amount is relatively not big. 我认为这个数额相对不大。 However, sometimes, my app will give level 1 or 2 memory warning (never crash and I don't do anything for this warning in my code). 但是,有时候,我的应用程序会给出1级或2级内存警告(从不崩溃,我的代码中没有为此警告做任何事情)。
so I am wondering what's really behind iphone memory thing. 所以我想知道iPhone背后的东西究竟是什么。 I mean, does real memory the only things that triggers warnings? 我的意思是,真正的记忆是唯一触发警告的东西吗? or there is anything else (such as virtual memory, as shown in the Instruments) inside the whole memory I should take care of? 或者还有什么其他的(比如虚拟内存,如仪器中所示)我应该照顾整个内存?
Although my app never crash due to memory issues, this warning thing (especially level 2 warning) really annoys me and makes me fear of crashing once I release it to public in the future. 虽然我的应用程序永远不会因为内存问题而崩溃,但这个警告事件(尤其是2级警告)确实让我感到烦恼,并且一旦我将其发布给公众,我就会害怕崩溃。
Any help? 有帮助吗?
Thanks 谢谢
Memory warnings exist to tell your app you're nearing your limit. 存在内存警告,告诉您的应用程序即将接近您的限制。 They are not necessarily a 'bad' thing - plenty of applications simply ignore them. 它们不一定是“坏”的东西 - 许多应用程序只是忽略它们。
The actual implementation details about when a memory warning is triggered are not important, and in fact will vary considerably from device to device. 关于何时触发内存警告的实际实现细节并不重要,实际上在不同设备之间会有很大差异。 An iPhone 4 might have 512MB of RAM to play with, but a 3GS will have half that. iPhone 4可能有512MB的RAM供玩,但3GS只有一半。
That said, there are some things worth knowing about memory warnings: 也就是说,有些事情值得了解内存警告:
Again, the exact implementation details are undocumented, and you shouldn't need to care about them. 同样,确切的实现细节没有记录,您不需要关心它们。 A memory warning is an opportunity for you to help the system by freeing up any objects you don't need. 内存警告是您通过释放任何不需要的对象来帮助系统的机会。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.