SyncKit
SyncKit copied to clipboard
memory issue (iOS) with tens of objects having NSBinaryDataAttributeType
I am having problems with sharing tens of objects with binary data (NSBinaryDataAttributeType) and cannot find a good solution yet. There is an entity with NSBinaryDataAttributeType, that I sync to CloudKit. I added quite a few such objects, then I enabled sync on another iOS device and these objects (CKRecords) were downloaded to it. During saveChangesInRecords: NSManagedObjects are being created and then NSData objects (20-30 MBs) are being created and assigned as properties (values - valueForKey:) for these objects. Memory usage increases with creation of each such object. Finally after one of such NSData creation all allowed memory is being used and iOS kills the app with the message ("Message from debugger: Terminated due to memory issue"). Do you have any thoughts what can be done here to avoid this crash? While these objects are not being saved (or re-faulted. But as fas as I can tell, they cannot be re-faulted, because they have unsaved properties and these changes will be lost if they are turned into faults before saving), they stay in memory (with their properties). So, the only way to reduce memory usage is to introduce an extra saving in some circumstances when applying attribute changes during saveChangesInRecords:. Not sure if it might cause some side effects for SyncKit. Or what are your thoughts regarding this issue?