由于内存管理(使用核心数据)导致的崩溃问题 [英] Crashing issue due to memory management (using Core Data)

查看:114
本文介绍了由于内存管理(使用核心数据)导致的崩溃问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用核心数据.从那里我正在检索10000多个数据

I am using Core Data. From there i am retrieving 10000+ data

使用NSOperation,我正在UITableView上显示大量数据.

Using NSOperation, i am displaying huge data on UITableView.

但是正如我在XCode Instruments中看到的那样,我的内存使用量不断增加

but as i can see in XCode Instruments my memory usage continuously increasing

那是原因,崩溃的活动存在于模拟器中不在的设备中

thats the reason, crashing activity is there in device not in simulator

有人想对此发表评论吗?

Any one would like to comment on this ?

推荐答案

不要一次检索10000个对象.

Don't retrieve 10000 objects at once.

使用NSAutoreleasePool并以一定的间隔刷新池(间隔将通过测试确定).

Use the NSAutoreleasePool and flush the pool at some consistent interval (interval to be determined via testing).

每N次迭代:

  1. 保存您的上下文
  2. 重置上下文
  3. 排干泳池

这将在导入期间降低内存使用量.

This will keep your memory usage down during import.

这篇关于由于内存管理(使用核心数据)导致的崩溃问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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