Cloudkit and CoreData Sync memory issue with image Data.

I have created a core data model in which i add images of binary data type with "Allow external storage". I Sync it on iCloud with Cloudkit using "NSPersistentCloudKitContainer". When it automatically sync it from cloud to other device or i uninstall the app and re install it. I have a memory crash as follow.


<NSSQLSaveChangesRequestContext: 0x281ec8420> , *** NSAllocateMemoryPages(28317598) failed with userInfo of (null)


Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** NSAllocateMemoryPages(28317598) failed


I got this crash after updating to iOS 13.1 beta 2. I don't get this crash on simulator iOS 13.0 (It sync it succeccfully from cloud in simulator.)

I have exactly the same problem, I use NSPersistentCloudKitContainer with Catalyst.
The problem started after I deployed the Schema to production.

The synchronization works perfectly on all devices (mac, iPhone, Simulator) until I add a photo from Simulator. This photo is synchronized with Mac, but as soon as it tries to sync with iPhone, it crashes.
The only way I found not to crash, is to delete as many photos as I had added from Simulator.
After that, iPhone crashes stops and starts syncing again.


EDIT:
I've found that the problem is not from the simulator but from a big image.

I tried that using a 8k image and it crashed.

If I deselect the "Allow External Storage" option though, it works fine.

Cloudkit and CoreData Sync memory issue with image Data.
 
 
Q