Releases: Tencent/MMKV
Releases · Tencent/MMKV
v1.2.0
v1.2.0 / 2020-06-30
This is the second major version of MMKV. Everything you call is the same as the last version, while almost everything underneath has been improved.
- Reduce Memory Footprint. We used to cache all key-values in a dictionary for efficiency. From now on we store the offset of each key-value inside the mmap-memory instead, reducing memory footprint by almost half for (non-encrypt) MMKV. And the accessing efficiency is almost the same as before. As for encrypted MMKV, we can't simply store the offset of each key-value, the relative encrypt info needs to be stored as well. That will be too much for small key-values. We only store such info for large key-values (larger than 256B).
- Improve Writeback Efficiency. Thanks to the optimization above, we now can implement writeback by simply calling memmove() multiple times. Efficiency is increased and memory consumption is down.
- Optimize Small Key-Values. Small key-values of encrypted MMKV are still cached in memory, as all the old versions did. From now on, the struct
MMBuffer
will try to store small values in the stack instead of in the heap, saving a lot of time frommalloc()
&free()
. In fact, all primitive types will be store in the stack memory.
All of the improvements above are available to all supported platforms. Here are the additional changes for each platform.
iOS / macOS
- Optimize insert & delete. Especially for inserting new values to existing keys, or deleting keys. We now use the UTF-8 encoded keys in the mmap-memory instead of live encoding from keys, cutting the cost of string encoding conversion.
- Fix Xcode compile error on some projects.
- Drop the support of iOS 8.
thread_local
is not available on iOS 8. We choose to drop support instead of working around because iOS 8's market share is considerably small.
POSIX
- It's known that GCC before 5.0 doesn't support C++17 standard very well. You should upgrade to the latest version of GCC to compile MMKV.
v1.1.2
v1.1.1
v1.1.1 / 2020-04-13
iOS / macOS
- Support WatchOS.
- Rename
+[MMKV onExit]
to+[MMKV onAppTerminate]
, to avoid naming conflict with some other OpenSource projects. - Make background write protection much more robust, fix a potential crash when writing meta info in background.
- Fix a potential data corruption bug when writing a UTF-8 (non-ASCII) key.
Android
- Fix a crash in the demo project when the App is hot reloaded.
- Improve wiki & readme to recommend users to init & destruct MMKV in the
Application
class instead of theMainActivity
class.
POSIX
- Fix two compile errors with some compilers.
v1.1.0
v1.1.0 / 2020-03-24
This is the first major breaking version ever since MMKV was made public in September 2018, introducing bunches of improvement. Due to the Covid-19, it has been delayed for about a month. Now it's finally here!
- Improved File Recovery Strategic. We store the CRC checksum & actual file size on each sync operation & full write back, plus storing the actual file size in the same file(aka the .crc meta file) as the CRC checksum. Base on our usage inside WeChat on the iOS platform, it cuts the file corruption rate down by almost half.
- Unified Core Library. We refactor the whole MMKV project and unify the cross-platform Core library. From now on, MMKV on iOS/macOS, Android, Win32 all share the same core logic code. It brings many benefits such as reducing the work to fix common bugs, improvements on one platform are available to other platforms immediately, and much more.
- Supports POSIX Platforms. Thanks to the unified Core library, we port MMKV to POSIX platforms easily.
- Multi-Process Access on iOS/macOS. Thanks to the unified Core library, we add multi-process access to iOS/macOS platforms easily.
- Efficiency Improvement. We make the most of armv8 ability including the AES & CRC32 instructions to tune encryption & error checking speed up by one order higher than before on armv8 devices. There are bunches of other speed tuning all around the whole project.
Here are the old-style change logs of each platform.
iOS / macOS
- Adds multi-process access support. You should initialize MMKV by calling
+[MMKV initializeMMKV: groupDir: logLevel:]
, passing your shared folder by calling-[NSFileManager containerURLForSecurityApplicationGroupIdentifier:]
with app group id. Then you can get a multi-process instance by calling+[MMKV mmkvWithID: mode:]
or+[MMKV mmkvWithID: cryptKey: mode:]
, accessing it cross your app & your app extensions. - Add inter-process content change notification. You can get MMKV changes notification of other processes by implementing
- onMMKVContentChange:
of<MMKVHandler>
protocol. - Improved File Recovery Strategic. Cuts the file corruption rate down by almost half. Details are above.
- Efficiency Improvement. Encryption & error checking speed are up by one order higher on armv8 devices(aka iDevice including iPhone 5S and above). Encryption on armv7 devices is improved as well. Details are ahead.
- Other speed improvements. Refactor core logic using MRC, improve std::vector
push_back()
speed by using move constructors & move assignments. +[MMKV setMMKVBasePath:]
&+[MMKV setLogLevel:]
are marked deprecated. You should use+[MMKV initializeMMKV:]
or+[MMKV initializeMMKV: logLevel:]
instead.- The
MMKVLogLevel
enum has been improved in Swift. It can be used likeMMKVLogLevel.info
and so on.
Android
- Improved File Recovery Strategic. Cuts the file corruption rate down by almost half. Details are above.
- Efficiency Improvement. Encryption & error checking speed are up by one order higher on armv8 devices with the
arm64-v8a
abi. Encryption onarmeabi
&armeabi-v7a
is improved as well. Details are ahead. - Add exception inside core encode & decode logic, making MMKV much more robust.
- Other speed improvements. Improve std::vector
push_back()
speed by using move constructors & move assignments.
Win32
- Improved File Recovery Strategic. Cuts the file corruption rate down by almost half. Details are above.
- Add exception inside core encode & decode logic, making MMKV much more robust.
- Other speed improvements. Improve std::vector
push_back()
speed by using move constructors & move assignments.
POSIX
- Most things actually work! We have tested MMKV on the latest version of Linux(Ubuntu, Arch Linux, CentOS, Gentoo), and Unix(macOS, FreeBSD, OpenBSD) by the time v1.1.0 is released.
v1.0.24
v1.0.24 / 2020-01-16
iOS / macOS
What's new
- Fix a bug that MMKV will fail to save any key-values after calling
-[MMKV clearMemoryCache]
and then-[MMKV clearAll]
. - Add
-[MMKV initializeMMKV:]
for users to init MMKV in the main thread, to avoid an iOS 13 potential crash when accessingUIApplicationState
in child threads. - Fix a potential crash when writing a uniquely constructed string.
- Fix a performance slow down when acquiring MMKV instances too often.
- Make the baseline test in MMKVDemo more robust to NSUserDefaults' caches.
Android
What's new
- Fix
flock()
bug on ashmem files in Android. - Fix a potential crash when writing a uniquely constructed string.
- Fix a bug that the MMKVDemo might crash when running in a simulator.
Win32
- Fix a potential crash when writing a uniquely constructed string or data.
v1.0.23
v1.0.23 / 2019-09-03
iOS / macOS
What's new
- Fix a potential security leak on encrypted MMKV.
Android
What's new
- Fix a potential security leak on encrypted MMKV.
- Fix filename bug when compiled on Win32 environment.
- Add option for decoding String Set into other
Set<>
classes other than the defaultHashSet<String>
, checkdecodeStringSet()
for details. - Add
putBytes()
&getBytes()
, to make function names more clear and consistent. - Add notification of content changed by other process, check the new
MMKVContentChangeNotification<>
interface &checkContentChangedByOuterProcess()
for details.
Win32
What's new
- Fix a potential security leak on encrypted MMKV.
- Fix
CriticalSection
init bug.
v1.0.22
v1.0.22 / 2019-06-10
iOS / macOS
What's new
- Fix a bug that MMKV will corrupt while adding just one key-value, and reboot or clear memory cache. This bug was introduced in v1.0.21.
Android
What's new
- Fix a bug that MMKV will corrupt while adding just one key-value, and reboot or clear memory cache. This bug was introduced in v1.0.21.
Win32
What's new
- Fix a bug that MMKV will corrupt while adding just one key-value, and reboot or clear memory cache. This bug was introduced in v1.0.21.
v1.0.20
v1.0.20 / 2019-06-05
iOS / macOS
What's new
- Fix a bug that MMKV might crash while storing key-value with specific length.
- Fix a bug that
-[MMKV trim]
might not work properly.
Android
What's new
- Migrate to AndroidX library.
- Fix a bug that MMKV might crash while storing key-value with specific length.
- Fix a bug that
trim()
might not work properly. - Fix a bug that dead-lock might be reported by Android mistakenly.
- Using
RegisterNatives()
to simplify native method naming.
Win32
- Fix a bug that MMKV might crash while storing key-value with specific length.
- Fix a bug that
trim()
might not work properly. - Fix a bug that
clearAll()
might not work properly.
v1.0.19
v1.0.19 / 2019-04-22
iOS / macOS
What's new
- Support Swift 5.
- Add method to get all keys
-[MMKV allKeys]
; - Add method to synchronize to file asynchronously
-[MMKV async]
. - Fix a pod configuration bug that might override target project's C++ setting on
CLANG_CXX_LANGUAGE_STANDARD
. - Fix a bug that
DEFAULT_MMAP_SIZE
might not be initialized before getting any MMKV instance. - Fix a bug that openssl's header files included inside MMKV might mess with target project's own openssl implementation.
Android
What's new
- Support Android Q.
- Add method to synchronize to file asynchronously
void sync()
, orvoid apply()
that comes withSharedPreferences.Editor
interface. - Fix a bug that a buffer with length of zero might be returned when the key is not existed.
- Fix a bug that
DEFAULT_MMAP_SIZE
might not be initialized before getting any MMKV instance.
v1.0.18
v1.0.18 / 2019-03-14
iOS / macOS
What's new
- Fix a bug that defaultValue was not returned while decoding a
NSCoding
value. - Fix a compile error on static linking MMKV while openssl is static linked too.
Android
What's new
- Introducing Native Buffer. Checkout wiki for details.
- Fix a potential crash when trying to recover data from file length error.
- Protect from mistakenly passing
Context.MODE_MULTI_PROCESS
to init MMKV.
Win32
- Fix a potential crash when trying to recover data from file length error.