views:

14

answers:

1

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.

+1  A: 

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

TechZen
Yes that is exactly what is happening (I did some debugging...), and that was exactly the kind of information that I was looking for.Thank you!
Krumelur