iPad View控制器内存管理 [英] iPad View Controller Memory Management
问题描述
我的iPad应用程序中有3个视图控制器。当第一个出现时,Instruments中的Activity Monitor告诉我该应用程序的内存为25MB。在[self presentModalViewController]调用之后,弹出一个新的视图控制器,内存增加到50MB,然后是第三个,70-75MB。
I have 3 view controllers in my iPad app. When the first one shown up, the Activity Monitor in Instruments told me that the app's memory was 25MB. After a [self presentModalViewController] call, a new view controller popped up, the memory gone up to 50MB, and then the third one, 70-75MB.
什么是iPad开发的最佳视图控制器内存管理?当我在真正的iPad上时,我总是会收到内存警告。
What is the best view controller memory management for the iPad development? I always receive Memory Warning now when I'm on a real iPad.
提前致谢。我很抱歉我的英语,因为它不是我的母语。 :)
Thanks in advance. I'm sorry for my English, since it's not my native language. :)
推荐答案
你检查过内存泄漏了吗?
b $ b仪器 - >泄漏。
http://developer.apple.com/library/ios/#documentation/Performance/Conceptual/ManagingMemory/Articles/FindingLeaks.html
另一个考虑因素是正确分配和释放所有对象,这并不容易,但是必要。
Have you checked your memory leaks?
Instruments -> Leaks.
http://developer.apple.com/library/ios/#documentation/Performance/Conceptual/ManagingMemory/Articles/FindingLeaks.html
Another consideration is to alloc and release all object correctly, that is not easy, but necessary.
您可以从构建选项中启用另一个控件: RUN_CLANG_STATIC_ANALYZER
在编译时显示所有错误的版本。
You can enable another control from build options: RUN_CLANG_STATIC_ANALYZER
to show all wrong release at compile time.
alberto,
这篇关于iPad View控制器内存管理的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!