迁移模型时内存不足
我正在将 iPhone 中的数据从一个型号版本迁移到另一个型号版本,但迁移会导致设备内存不足并崩溃。更不用说它在设备上需要很长时间了。我使用默认的迁移设置。
我猜想坏人是包含 105 行顺序的表之一。虽然该表没有更改,但迁移仍然会为其生成操作(可能是因为与其他表的关系)。
我有什么想法可以改善事情吗?当然,我可以手动创建一些东西,但我真的想尽可能多地利用核心数据的好处。
I am migrating data from one model version to another in the iPhone, but the migration causes the device to run out of memory and crash. Not to mention it takes forever on the device. I use the default migration settings.
I guess the bad guy is one of the tables that contain the order of 105 rows. This table has not changed though, but the migration still generates operations for it (probably because of relations to other tables).
Any ideas what i can do to improve things? Of course, I could whip something up manually, but I really want to take advantage of as much as possible of the Core Data goodies.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您很可能在迁移过程中创建了大量对象并且没有释放它们。您需要循环执行迁移,获取小半字节并释放每个半字节中使用的内存,然后再获取下一个半字节。
请参阅《核心数据模型版本控制和数据迁移编程指南》:多次传递 — 处理大型数据集
You're most likely creating a large number of objects during the migration and not releasing them. You need to loop through the migration taking small nibbles and freeing up the memory used in each nibble before taking the next one.
See the Core Data Model Versioning and Data Migration Programming Guide: Multiple Passes—Dealing With Large Datasets