The way I\'m trying to delete multiple sets of 10.000+ NSManagedObjects is just too memory intensive (around 20MB live bytes), and my app is being jettisoned. Here is the im
If you do not want to use another API, try another feature of NSFetchRequest
, fetchLimit
, maybe in conjunction with fetchOffset
. I have seen this in one of the iTunes U iPad courses in an example involving heavy number crunching with Core Data.
NSInteger limit = 500;
NSInteger count = [context countForFetchRequest:fetch error:nil];
[fetch setFetchLimit:limit];
for (int i=0; i < count/limit+1; i++) {
// do the fetch and delete and save
}
You can adjust the fetchLimit
to satisfy your memory requirements.