I\'m trying to perform a task similar to this:
NSFetchRequest *request = [NSFetchRequest fetchRequestWithEntityName:@\"Entry\"];
NSPredicate *predicate
You guessed right. You have to use setFetchBatchSize:
. This will only return the first 20 objects. If you want to get the next 20 objects, you have to set the offset using setFetchOffset:.
This is a perfect case for using an @autoreleasepool
Place an @autoreleasepool around all the code which gets executed in your loop. This will automatically release the objects after they get processed so your memory footprint stays low. If using this technique you shouldn't have to specify a batch size.
See the apple docs here for more information;
https://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/MemoryMgmt/Articles/mmAutoreleasePools.html