1

DESCRIPTION OF PROBLEM: When syncing large items (such as images) with NSPersistentCloudKitContainer, my app crashes with the error 'NSAllocateMemoryPages() failed'. This happens repeatedly within a minute of launching the app. It happens both in production and development environments.

The crash does not happen if the user disconnects from the internet, or turns off iCloud sync for my app.

The images are stored in Core Data as "Binary Data" in separate entities with "many to one" relationships to their parent entities. The setup is adapted from this exaple: https://developer.apple.com/documentation/coredata/synchronizing_a_local_store_to_the_cloud

STEPS TO REPRODUCE: Add multiple images to core data at once or sync with an iCloud account that already has multiple images in the private iCloud container.

PLATFORM AND VERSION: Happens on both iPhone X and iPad Pro (gen 1) running iOS 13.3.1.

Have anybody else come accross this issue? All suggestions will be very welcome!

mort
  • 71
  • 1
  • 6

1 Answers1

0

I found the problem in the end. I was storing full-res images of sizes exceeding 20 MB. Compressing the images made the problem go away. It looks like NSPersistentCloudKitContainer is not happy with syncing RawData fields larger than around 15 MB. If anyone has more details on this I would be very interested to learn more about this size-limitation and where/if it is documented!

mort
  • 71
  • 1
  • 6