caiyue1993/IceCream

Crash on mmap

Closed this issue · 5 comments

Expected behavior

No crash on sync.

Actual behavior(optional)

Crash on sync.

Thread 18: Fatal error: 'try!' expression unexpectedly raised an error: Error Domain=io.realm Code=9 "mmap() failed: Cannot allocate memory size: 28311552 offset: 67108864" UserInfo={NSLocalizedDescription=mmap() failed: Cannot allocate memory size: 28311552 offset: 67108864, Error Code=9}

image

Reference links(optional)

Realm recommends using autoreleasepool when using Realm in threads. Should the BackgroundWorker.shared.start inner block be wrapped in an autoreleasepool to possibly resolve this?

I tried adding autopoolrelease and get the same crash, maybe this is not IceCream's fault:

image

Looks like this is a Realm issue with many people running into it: realm/realm-swift#6572

Regardless, it does seem like this ought to have autoreleasepool per Realm's docs?

I'm also getting that issue with Realm 5.1.0.

It should not be an issue of IceCream. Someone says that downgrading Realm to 4.4.1 helps: realm/realm-swift#6572 (comment)
You guys could give it a try.

Thanks. Does the inclusion of autoreleasepool make sense there regardless?