迁移模型时内存不足

发布于 2024-09-07 20:27:30 字数 220 浏览 1 评论 0原文

我正在将 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

格子衫的從容 2024-09-14 20:27:30

您很可能在迁移过程中创建了大量对象并且没有释放它们。您需要循环执行迁移,获取小半字节并释放每个半字节中使用的内存,然后再获取下一个半字节。

请参阅《核心数据模型版本控制和数据迁移编程指南》:多次传递 — 处理大型数据集

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文