我已经阅读了其他stackoverflow帖子以及建议使用shouldCompactOnLaunch的领域问题。我已经在最新版本中实现了它,但是仍然会看到此崩溃。
Fatal Exception: RLMException
mmap() failed: Cannot allocate memory size: 1048576
0 CoreFoundation 0x1e82a8ec4 __exceptionPreprocess
1 libobjc.A.dylib 0x1e7479a40 objc_exception_throw
2 Canary-iOS 0x102b91e90 RLMSetErrorOrThrow(NSError*, NSError* __autoreleasing*) (RLMUtil.mm:336)
3 Canary-iOS 0x102b64450 RLMRealmTranslateException(NSError* __autoreleasing*) (RLMRealm.mm:316)
4 Canary-iOS 0x102b662bc -[RLMRealm commitWriteTransaction:] (RLMRealm.mm:591)
5 Canary-iOS 0x10278c70c -[CanaryCoreRealmManager synchronizeLogsChangesSync] (CanaryCoreRealmManager.m:943)
6 libdispatch.dylib 0x1e7ce16c8 _dispatch_call_block_and_release
7 libdispatch.dylib 0x1e7ce2484 _dispatch_client_callout
8 libdispatch.dylib 0x1e7c89bd0 _dispatch_lane_serial_drain$VARIANT$mp
9 libdispatch.dylib 0x1e7c8a718 _dispatch_lane_invoke$VARIANT$mp
10 libdispatch.dylib 0x1e7c92eb8 _dispatch_workloop_worker_thread
11 libsystem_pthread.dylib 0x1e7ec50dc _pthread_wqthread
12 libsystem_pthread.dylib 0x1e7ec7cec start_wqthread
我已验证该数据库的大小约为5MB。
仅当应用程序在后台或不在后台时,才会发生崩溃。
在每个崩溃日志中,分配失败的大小都是相同的(1048576)。
构建信息:
ProductName: Mac OS X
ProductVersion: 10.14.1
BuildVersion: 18B75
/Applications/Xcode.app/Contents/Developer
Xcode 10.1
Build version 10B61
/Users/dev/.rvm/rubies/ruby-2.4.2/bin/pod
1.5.3
Realm (3.13.0)