github Tencent/MMKV v1.3.2

latest releases: v1.3.9, v1.3.7, v1.3.6...
10 months ago

v1.3.2 / 2023-11-20

Among most of the features added in this version, the credit goes to @kaitian521.

Changes for All platforms

  • Add the feature of customizing the initial file size of an MMKV instance.
  • Optimize write speed when there's only one key inside MMKV, the new key is the same as the old one, and MMKV is in SINGLE_PROCESS_MODE.
  • Optimize write speed by overriding from the beginning of the file instead of append in the back, when there's zero key inside MMKV, and MMKV is in SINGLE_PROCESS_MODE.
  • Add the feature of clearAll() with keeping file disk space unchanged, reducing the need to expand file size on later insert & update operations. This feature is off by default, you will have to call it with relative params or newly added methods.
  • Add the feature of comparing values before setting/encoding on the same key.
  • Fix a potential bug that the MMKV file will be invalid state after a successful expansion but a failure zeroFill(), will lead to a crash.
  • Fix a potential crash due to other module/static lib turn-off RTTI, which will cause MMKV to fail to catch std::exception.
  • Fix several potential crashes due to the MMKV file not being valid.

Android

  • Use the -O2 optimization level by default, which will reduce native lib size and improve read/write speed a little bit.
  • Experimantal use @fastNative annotation on enableCompareBeforeCompare() to speed up JNI call.

iOS & macOS

  • Optimize auto-clean logic to reduce lock waiting time.
  • Turn-off mlock() protection in background on iOS 13+. We have verified it on WeChat that the protection is no longer needed from at least iOS 13. Maybe iOS 12 or older is also not needed, but we don't have the chance to verify that because WeChat no longer supports iOS 12.

Known Issue

  • On Xcode 15 build, the App will crash on iOS 14 and below. The bug is introduced by Apple's new linker. The official solutions provided by Apple are either:
    • Drop the support of iOS 14.
    • Add -Wl,-weak_reference_mismatches,weak or -Wl,-ld_classic options to the OTHER_LDFLAGS build setting of Xcode 15. Note that these options are not recognized by older versions of Xcode.
    • Use older versions of Xcode, or wait for Xcode 15.2.

Don't miss a new MMKV release

NewReleases is sending notifications on new releases.