【发布时间】:2011-03-09 19:19:14
【问题描述】:
我将 Instruments 与 Allocations 工具一起使用。我只测试与我的应用的固定交互。
我有一个导航控制器,它有 4 个阶段。前两个阶段是标准表格视图控制器,后两个阶段是具有动态加载图像的自定义控制器。
所以我在仪器中运行我的应用程序(通过使用性能工具运行 -> 分配)并执行以下交互:
1. App Loads
2. I wait a bit until allocations graph stabilizes
3. I tap/push into my navigation controller until the deepest level.
4. I wait for the images to load and for the allocations graph to stabilize.
5. I tap back out of the navigation controller until I'm back to the root level.
6. I wait for the allocations graph to stabilize.
7. GOTO 3.
现在我注意到,在从 3 到 7 的每次迭代之间,分配图显示的值略高。因此,即使我在做同样的事情并且所有视图控制器的 dealloc 都被调用,总体分配也在增加。
所以时间线大致是这样的:
1. Start: 1mb
2. Push controllers/Load images: 4mb
3. Pop controllers: 1.1mb
4. Push controllers/Load images: 4.1mb
5. Pop controllers: 1.2mb
6. ... etc ... (always increasing slightly)
所以我的问题是这是否意味着我有泄漏或者这是正常的?此外,分配图数据实际上代表什么?为什么即使我弹回到初始状态,价值也会增加?我担心如果我的应用程序运行时间足够长,即使用户所做的只是推送和弹出视图控制器,它也会消耗太多内存。
任何想法都会有所帮助。
【问题讨论】:
标签: iphone uinavigationcontroller memory-management instruments