I am using Core Data extensively in one of my apps. Usually, for UITableView, I am using NSFetchedResultsController. But in a specific view controller I need to show a sum of some data – what requires me to first fetch the data, and then make a for cycle to analyze the data and make the calculations.
However, I thought that, if I fetch a very large amount of data (let’s say, 10.000 objects that each holds an NSString and a float), and making a for cycle, it could cause my app to crash. Is this a serious risk? If it does, how I could solve it? (I thought of creating an NSAutoReleasePool, adding and releasing each object after calculation, but I am using ARC so I think I can’t).
Use an autorelease pool in a loop like that…
Also, you should make sure to
retainsRegisteredObjectsis NO on your managed object context. In addition, if you really start using too much, you can manually control your faults by releasing them withrefreshObject:mergeChanges: