An efficient, small mobile key-value storage framework developed by WeChat. Works on Android, iOS, macOS, Windows, and POSIX.

Overview

license PRs Welcome Release Version Platform

中文版本请参看这里

MMKV is an efficient, small, easy-to-use mobile key-value storage framework used in the WeChat application. It's currently available on Android, iOS/macOS, Win32 and POSIX.

MMKV for Android

Features

  • Efficient. MMKV uses mmap to keep memory synced with file, and protobuf to encode/decode values, making the most of Android to achieve best performance.

    • Multi-Process concurrency: MMKV supports concurrent read-read and read-write access between processes.
  • Easy-to-use. You can use MMKV as you go. All changes are saved immediately, no sync, no apply calls needed.

  • Small.

    • A handful of files: MMKV contains process locks, encode/decode helpers and mmap logics and nothing more. It's really tidy.
    • About 50K in binary size: MMKV adds about 50K per architecture on App size, and much less when zipped (apk).

Getting Started

Installation Via Maven

Add the following lines to build.gradle on your app module:

dependencies {
    implementation 'com.tencent:mmkv:1.2.11'
    // replace "1.2.11" with any available version
}

Starting from v1.2.8, MMKV has been migrated to Maven Central.
For other installation options, see Android Setup.

Quick Tutorial

You can use MMKV as you go. All changes are saved immediately, no sync, no apply calls needed.
Setup MMKV on App startup, say your Application class, add these lines:

public void onCreate() {
    super.onCreate();

    String rootDir = MMKV.initialize(this);
    System.out.println("mmkv root: " + rootDir);
    //……
}

MMKV has a global instance, that can be used directly:

import com.tencent.mmkv.MMKV;
    
MMKV kv = MMKV.defaultMMKV();

kv.encode("bool", true);
boolean bValue = kv.decodeBool("bool");

kv.encode("int", Integer.MIN_VALUE);
int iValue = kv.decodeInt("int");

kv.encode("string", "Hello from mmkv");
String str = kv.decodeString("string");

MMKV also supports Multi-Process Access. Full tutorials can be found here Android Tutorial.

Performance

Writing random int for 1000 times, we get this chart:

For more benchmark data, please refer to our benchmark.

MMKV for iOS/macOS

Features

  • Efficient. MMKV uses mmap to keep memory synced with file, and protobuf to encode/decode values, making the most of iOS/macOS to achieve best performance.

  • Easy-to-use. You can use MMKV as you go, no configurations needed. All changes are saved immediately, no synchronize calls needed.

  • Small.

    • A handful of files: MMKV contains encode/decode helpers and mmap logics and nothing more. It's really tidy.
    • Less than 30K in binary size: MMKV adds less than 30K per architecture on App size, and much less when zipped (ipa).

Getting Started

Installation Via CocoaPods:

  1. Install CocoaPods;
  2. Open terminal, cd to your project directory, run pod repo update to make CocoaPods aware of the latest available MMKV versions;
  3. Edit your Podfile, add pod 'MMKV' to your app target;
  4. Run pod install;
  5. Open the .xcworkspace file generated by CocoaPods;
  6. Add #import <MMKV/MMKV.h> to your source file and we are done.

For other installation options, see iOS/macOS Setup.

Quick Tutorial

You can use MMKV as you go, no configurations needed. All changes are saved immediately, no synchronize calls needed. Setup MMKV on App startup, in your -[MyApp application: didFinishLaunchingWithOptions:], add these lines:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    // init MMKV in the main thread
    [MMKV initializeMMKV:nil];

    //...
    return YES;
}

MMKV has a global instance, that can be used directly:

MMKV *mmkv = [MMKV defaultMMKV];
    
[mmkv setBool:YES forKey:@"bool"];
BOOL bValue = [mmkv getBoolForKey:@"bool"];
    
[mmkv setInt32:-1024 forKey:@"int32"];
int32_t iValue = [mmkv getInt32ForKey:@"int32"];
    
[mmkv setString:@"hello, mmkv" forKey:@"string"];
NSString *str = [mmkv getStringForKey:@"string"];

MMKV also supports Multi-Process Access. Full tutorials can be found here.

Performance

Writing random int for 10000 times, we get this chart:

For more benchmark data, please refer to our benchmark.

MMKV for Win32

Features

  • Efficient. MMKV uses mmap to keep memory synced with file, and protobuf to encode/decode values, making the most of Windows to achieve best performance.

    • Multi-Process concurrency: MMKV supports concurrent read-read and read-write access between processes.
  • Easy-to-use. You can use MMKV as you go. All changes are saved immediately, no save, no sync calls needed.

  • Small.

    • A handful of files: MMKV contains process locks, encode/decode helpers and mmap logics and nothing more. It's really tidy.
    • About 10K in binary size: MMKV adds about 10K on application size, and much less when zipped.

Getting Started

Installation Via Source

  1. Getting source code from git repository:

    git clone https://github.com/Tencent/MMKV.git
    
  2. Add Win32/MMKV/MMKV.vcxproj to your solution;

  3. Add MMKV project to your project's dependencies;

  4. Add $(OutDir)include to your project's C/C++ -> General -> Additional Include Directories;

  5. Add $(OutDir) to your project's Linker -> General -> Additional Library Directories;

  6. Add MMKV.lib to your project's Linker -> Input -> Additional Dependencies;

  7. Add #include <MMKV/MMKV.h> to your source file and we are done.

note:

  1. MMKV is compiled with MT/MTd runtime by default. If your project uses MD/MDd, you should change MMKV's setting to match your project's (C/C++ -> Code Generation -> Runtime Library), or vise versa.
  2. MMKV is developed with Visual Studio 2017, change the Platform Toolset if you use a different version of Visual Studio.

For other installation options, see Win32 Setup.

Quick Tutorial

You can use MMKV as you go. All changes are saved immediately, no sync, no save calls needed.
Setup MMKV on App startup, say in your main(), add these lines:

#include <MMKV/MMKV.h>

int main() {
    std::wstring rootDir = getYourAppDocumentDir();
    MMKV::initializeMMKV(rootDir);
    //...
}

MMKV has a global instance, that can be used directly:

auto mmkv = MMKV::defaultMMKV();

mmkv->set(true, "bool");
std::cout << "bool = " << mmkv->getBool("bool") << std::endl;

mmkv->set(1024, "int32");
std::cout << "int32 = " << mmkv->getInt32("int32") << std::endl;

mmkv->set("Hello, MMKV for Win32", "string");
std::string result;
mmkv->getString("string", result);
std::cout << "string = " << result << std::endl;

MMKV also supports Multi-Process Access. Full tutorials can be found here Win32 Tutorial.

MMKV for POSIX

Features

  • Efficient. MMKV uses mmap to keep memory synced with file, and protobuf to encode/decode values, making the most of POSIX to achieve best performance.

    • Multi-Process concurrency: MMKV supports concurrent read-read and read-write access between processes.
  • Easy-to-use. You can use MMKV as you go. All changes are saved immediately, no save, no sync calls needed.

  • Small.

    • A handful of files: MMKV contains process locks, encode/decode helpers and mmap logics and nothing more. It's really tidy.
    • About 7K in binary size: MMKV adds about 7K on application size, and much less when zipped.

Getting Started

Installation Via CMake

  1. Getting source code from git repository:

    git clone https://github.com/Tencent/MMKV.git
    
  2. Edit your CMakeLists.txt, add those lines:

    add_subdirectory(mmkv/POSIX/src mmkv)
    target_link_libraries(MyApp
        mmkv)
  3. Add #include "MMKV.h" to your source file and we are done.

For other installation options, see POSIX Setup.

Quick Tutorial

You can use MMKV as you go. All changes are saved immediately, no sync, no save calls needed.
Setup MMKV on App startup, say in your main(), add these lines:

#include "MMKV.h"

int main() {
    std::string rootDir = getYourAppDocumentDir();
    MMKV::initializeMMKV(rootDir);
    //...
}

MMKV has a global instance, that can be used directly:

auto mmkv = MMKV::defaultMMKV();

mmkv->set(true, "bool");
std::cout << "bool = " << mmkv->getBool("bool") << std::endl;

mmkv->set(1024, "int32");
std::cout << "int32 = " << mmkv->getInt32("int32") << std::endl;

mmkv->set("Hello, MMKV for Win32", "string");
std::string result;
mmkv->getString("string", result);
std::cout << "string = " << result << std::endl;

MMKV also supports Multi-Process Access. Full tutorials can be found here POSIX Tutorial.

License

MMKV is published under the BSD 3-Clause license. For details check out the LICENSE.TXT.

Change Log

Check out the CHANGELOG.md for details of change history.

Contributing

If you are interested in contributing, check out the CONTRIBUTING.md, also join our Tencent OpenSource Plan.

To give clarity of what is expected of our members, MMKV has adopted the code of conduct defined by the Contributor Covenant, which is widely used. And we think it articulates our values well. For more, check out the Code of Conduct.

FAQ & Feedback

Check out the FAQ first. Should there be any questions, don't hesitate to create issues.

Issues
  • 能否支持OpenHarmony JS版本?

    能否支持OpenHarmony JS版本?

    I am developing an OpenHarmony application that uses the JavaScript language. Can you support the OpenHarmony JavaScript version? I am willing to participate in the development and look forward to reply.

    opened by hzjust 3
  • stringSet写入空集合,读取却返回null

    stringSet写入空集合,读取却返回null

    复现代码: (kotlin)

    MMKV.defaultMMKV().encode("emptySetTest", emptySet<String>())
    println(MMKV.defaultMMKV().decodeStringSet("emptySetTest"))
    

    运行结果: null 预期结果: []

    如果存入空的String Set, 那么读取就会返回null, 配合default value参数使用的情况下,写入空集合以后就会始终返回default value

    opened by re-ovo 4
  • FlutterPluginRegistrant 位置及“”问题

    FlutterPluginRegistrant 位置及“”问题

    Note:

    The language of MMKV

    flutter

    The version of MMKV

    v1.2.12

    The platform of MMKV

    iOS

    The installation of MMKV

    Cocoapods

    What's the issue?

    flutter demo project, ”FlutterPluginRegistrant“ path is ‘.ios/flutter/FlutterPluginRegistrant/FlutterPluginRegistrant.podspec’ and FlutterPluginRegistrant content is dependce "mmkv"

    What's the log of MMKV when that happened?

    opened by ForC-M 7
  • Run mmkv demo but crash on android emulator( API 16, armeabi-v7a)

    Run mmkv demo but crash on android emulator( API 16, armeabi-v7a)

    2021-11-12 02:33:39.924 890-1322/system_process I/ActivityManager: START {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 cmp=com.tencent.mmkvdemo/.MainActivity u=0} from pid 1741 2021-11-12 02:33:39.974 653-653/? D/PermissionCache: checking android.permission.READ_FRAME_BUFFER for uid=1000 => granted (1109 us) 2021-11-12 02:33:40.074 1741-1741/? D/AndroidRuntime: Shutting down VM 2021-11-12 02:33:40.094 1741-1754/? I/AndroidRuntime: NOTE: attach of thread 'Binder_3' failed 2021-11-12 02:33:40.094 1741-1745/? D/dalvikvm: GC_CONCURRENT freed 102K, 77% free 489K/2048K, paused 2ms+1ms, total 17ms 2021-11-12 02:33:40.104 1741-1747/? D/jdwp: Got wake-up signal, bailing out of select 2021-11-12 02:33:40.104 1741-1747/? D/dalvikvm: Debugger has detached; object registry had 1 entries 2021-11-12 02:33:40.114 653-653/? D/gralloc_ranchu: gralloc_alloc: Creating ashmem region of size 2260992 2021-11-12 02:33:40.144 1382-1384/com.android.launcher D/dalvikvm: GC_CONCURRENT freed 2852K, 29% free 13358K/18695K, paused 71ms+56ms, total 279ms 2021-11-12 02:33:40.144 1382-1664/com.android.launcher D/dalvikvm: WAIT_FOR_CONCURRENT_GC blocked 235ms 2021-11-12 02:33:40.154 1382-1625/com.android.launcher D/dalvikvm: WAIT_FOR_CONCURRENT_GC blocked 213ms 2021-11-12 02:33:40.154 1382-1665/com.android.launcher D/dalvikvm: WAIT_FOR_CONCURRENT_GC blocked 202ms 2021-11-12 02:33:40.224 1755-1755/? D/dalvikvm: Not late-enabling CheckJNI (already on) 2021-11-12 02:33:40.234 890-902/system_process I/ActivityManager: Start proc com.tencent.mmkvdemo for activity com.tencent.mmkvdemo/.MainActivity: pid=1755 uid=10044 gids={1028} 2021-11-12 02:33:40.584 890-1006/system_process I/qtaguid: Failed write_ctrl(s 1 10044) res=-1 errno=1 2021-11-12 02:33:40.584 890-1006/system_process W/NetworkManagementSocketTagger: setKernelCountSet(10044, 1) failed with errno -1 2021-11-12 02:33:40.674 1755-1755/? E/Trace: error opening trace file: No such file or directory (2) 2021-11-12 02:33:40.854 1755-1755/? I/ActivityThread: Pub com.tencent.mmkvdemo.MMKVContentProvider: com.tencent.mmkv.MMKVContentProvider 2021-11-12 02:33:40.904 1755-1755/? I/MMKV: Enable checkProcessMode() 2021-11-12 02:33:40.924 1755-1755/? D/dalvikvm: DexOpt: couldn't find static field Landroid/os/Build;.SUPPORTED_ABIS 2021-11-12 02:33:40.924 1755-1755/? W/dalvikvm: VFY: unable to resolve static field 183 (SUPPORTED_ABIS) in Landroid/os/Build; 2021-11-12 02:33:40.924 1755-1755/? D/dalvikvm: VFY: replacing opcode 0x62 at 0x0006 2021-11-12 02:33:40.954 1755-1755/? D/dalvikvm: DexOpt: couldn't find field Landroid/content/pm/ApplicationInfo;.splitSourceDirs 2021-11-12 02:33:40.954 1755-1755/? W/dalvikvm: VFY: unable to resolve instance field 48 2021-11-12 02:33:40.954 1755-1755/? D/dalvikvm: VFY: replacing opcode 0x54 at 0x000c 2021-11-12 02:33:40.974 1755-1755/? D/dalvikvm: Trying to load lib /data/data/com.tencent.mmkvdemo/lib/libmmkv.so 0xaebc5330 2021-11-12 02:33:41.024 1755-1755/? D/dalvikvm: Added shared lib /data/data/com.tencent.mmkvdemo/lib/libmmkv.so 0xaebc5330 2021-11-12 02:33:41.044 1755-1755/? I/MMKV: native-bridge.cpp:104::JNI_OnLoad current API level = 16, libc++_shared=0 2021-11-12 02:33:41.054 1755-1755/? I/MMKV: MMKV.cpp:165::initialize version v1.2.11, page size 4096, arch armeabi-v7a/NEON 2021-11-12 02:33:41.064 1755-1755/? A/libc: Fatal signal 4 (SIGILL) at 0xa5923b6a (code=1), thread 1755 (encent.mmkvdemo) 2021-11-12 02:33:41.104 1382-1382/com.android.launcher D/EGL_emulation: eglMakeCurrent: 0xb7dda768: ver 2 0 2021-11-12 02:33:41.144 1382-1625/com.android.launcher D/dalvikvm: GC_FOR_ALLOC freed 1272K, 27% free 13746K/18695K, paused 620ms, total 642ms 2021-11-12 02:33:41.194 651-651/? I/DEBUG: *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** 2021-11-12 02:33:41.194 651-651/? I/DEBUG: Build fingerprint: 'generic/sdk/generic:4.1.2/MASTER/4875369:eng/test-keys' 2021-11-12 02:33:41.204 651-651/? I/DEBUG: pid: 1755, tid: 1755, name: encent.mmkvdemo >>> com.tencent.mmkvdemo <<< 2021-11-12 02:33:41.214 651-651/? I/DEBUG: signal 4 (SIGILL), code 1 (ILL_ILLOPC), fault addr a5923b6a 2021-11-12 02:33:41.264 1382-1382/com.android.launcher D/EGL_emulation: eglMakeCurrent: 0xb7dda768: ver 2 0 2021-11-12 02:33:41.304 890-897/system_process I/dalvikvm: Jit: resizing JitTable from 4096 to 8192 2021-11-12 02:33:41.514 651-651/? I/DEBUG: r0 b7cfd3b8 r1 b7cfd3aa r2 00000003 r3 00000000 2021-11-12 02:33:41.514 651-651/? I/DEBUG: r4 a594d0b0 r5 b7beb9e0 r6 00000000 r7 bee11678 2021-11-12 02:33:41.514 651-651/? I/DEBUG: r8 bee11704 r9 ab62acc4 sl b7beb9f0 fp bee1171c 2021-11-12 02:33:41.514 651-651/? I/DEBUG: ip c0000000 sp bee115d8 lr b6f86a7d pc a5923b6a cpsr 00000170 2021-11-12 02:33:41.514 651-651/? I/DEBUG: d0 000000a043200000 d1 3ff0000043200000 2021-11-12 02:33:41.534 651-651/? I/DEBUG: d2 bfd3441350baf6de d3 4008000000000000 2021-11-12 02:33:41.534 651-651/? I/DEBUG: d4 3fcef049fb9094d1 d5 3f40000000000000 2021-11-12 02:33:41.534 651-651/? I/DEBUG: d6 3fe999999999999a d7 000000a000000000 2021-11-12 02:33:41.534 651-651/? I/DEBUG: d8 0000000000000000 d9 0000000000000000 2021-11-12 02:33:41.534 651-651/? I/DEBUG: d10 0000000000000000 d11 0000000000000000 2021-11-12 02:33:41.534 651-651/? I/DEBUG: d12 0000000000000000 d13 0000000000000000 2021-11-12 02:33:41.544 651-651/? I/DEBUG: d14 0000000000000000 d15 0000000000000000 2021-11-12 02:33:41.544 651-651/? I/DEBUG: scr 60000010 2021-11-12 02:33:41.544 651-651/? I/DEBUG: backtrace: 2021-11-12 02:33:41.554 651-651/? I/DEBUG: #00 pc 00051b6a /data/data/com.tencent.mmkvdemo/lib/libmmkv.so (mmkv::mkPath(std::__ndk1::basic_string<char, std::__ndk1::char_traits, std::__ndk1::allocator > const&)+29) 2021-11-12 02:33:41.554 651-651/? I/DEBUG: #01 pc 00022a79 /system/lib/libc.so (strdup+24) 2021-11-12 02:33:41.554 651-651/? I/DEBUG: #02 pc 0000001c 2021-11-12 02:33:41.564 651-651/? I/DEBUG: stack: 2021-11-12 02:33:41.564 651-651/? I/DEBUG: bee11598 bee115b0 [stack] 2021-11-12 02:33:41.564 651-651/? I/DEBUG: bee1159c a594d0b0 /data/data/com.tencent.mmkvdemo/lib/libmmkv.so 2021-11-12 02:33:41.574 651-651/? I/DEBUG: bee115a0 0000002b
    2021-11-12 02:33:41.574 651-651/? I/DEBUG: bee115a4 b7cfd380 [heap] 2021-11-12 02:33:41.574 651-651/? I/DEBUG: bee115a8 bee11678 [stack] 2021-11-12 02:33:41.574 651-651/? I/DEBUG: bee115ac bee11704 [stack] 2021-11-12 02:33:41.574 651-651/? I/DEBUG: bee115b0 ab62acc4
    2021-11-12 02:33:41.574 651-651/? I/DEBUG: bee115b4 b7beb9f0 [heap] 2021-11-12 02:33:41.584 651-651/? I/DEBUG: bee115b8 bee1171c [stack] 2021-11-12 02:33:41.584 651-651/? I/DEBUG: bee115bc b7cfd3b8 [heap] 2021-11-12 02:33:41.584 651-651/? I/DEBUG: bee115c0 b7cfd3b8 [heap] 2021-11-12 02:33:41.584 651-651/? I/DEBUG: bee115c4 b6f86a7d /system/lib/libc.so (strdup+28) 2021-11-12 02:33:41.584 651-651/? I/DEBUG: bee115c8 a594d0b0 /data/data/com.tencent.mmkvdemo/lib/libmmkv.so 2021-11-12 02:33:41.594 651-651/? I/DEBUG: bee115cc b7beb9e0 [heap] 2021-11-12 02:33:41.594 651-651/? I/DEBUG: bee115d0 df0027ad
    2021-11-12 02:33:41.594 651-651/? I/DEBUG: bee115d4 00000000
    2021-11-12 02:33:41.604 651-651/? I/DEBUG: #00 bee115d8 a594e315 /data/data/com.tencent.mmkvdemo/lib/libmmkv.so 2021-11-12 02:33:41.604 651-651/? I/DEBUG: ........ ........ 2021-11-12 02:33:41.604 651-651/? I/DEBUG: #01 bee115d8 a594e315 /data/data/com.tencent.mmkvdemo/lib/libmmkv.so 2021-11-12 02:33:41.604 651-651/? I/DEBUG: bee115dc ffffffef
    2021-11-12 02:33:41.604 651-651/? I/DEBUG: bee115e0 0000002a
    2021-11-12 02:33:41.614 651-651/? I/DEBUG: bee115e4 00000020
    2021-11-12 02:33:41.614 651-651/? I/DEBUG: #02 bee115e8 0000000a
    2021-11-12 02:33:41.614 651-651/? I/DEBUG: bee115ec a594e314 /data/data/com.tencent.mmkvdemo/lib/libmmkv.so 2021-11-12 02:33:41.614 651-651/? I/DEBUG: bee115f0 00e11618
    2021-11-12 02:33:41.624 651-651/? I/DEBUG: bee115f4 00000014
    2021-11-12 02:33:41.624 651-651/? I/DEBUG: bee115f8 0000002a
    2021-11-12 02:33:41.624 651-651/? I/DEBUG: bee115fc b7cfd3b8 [heap] 2021-11-12 02:33:41.624 651-651/? I/DEBUG: bee11600 a594e314 /data/data/com.tencent.mmkvdemo/lib/libmmkv.so 2021-11-12 02:33:41.624 651-651/? I/DEBUG: bee11604 a594d0b0 /data/data/com.tencent.mmkvdemo/lib/libmmkv.so 2021-11-12 02:33:41.634 651-651/? I/DEBUG: bee11608 b7beb9e0 [heap] 2021-11-12 02:33:41.634 651-651/? I/DEBUG: bee1160c 00000000
    2021-11-12 02:33:41.634 651-651/? I/DEBUG: bee11610 bee11658 [stack] 2021-11-12 02:33:41.634 651-651/? I/DEBUG: bee11614 a590a2cf /data/data/com.tencent.mmkvdemo/lib/libmmkv.so (std::__ndk1::basic_string<char, std::__ndk1::char_traits, std::__ndk1::allocator >::assign(char const*, unsigned int)+158) 2021-11-12 02:33:41.644 651-651/? I/DEBUG: bee11618 00000000
    2021-11-12 02:33:41.644 651-651/? I/DEBUG: bee1161c 00000000
    2021-11-12 02:33:41.644 651-651/? I/DEBUG: bee11620 0000002a
    2021-11-12 02:33:41.644 651-651/? I/DEBUG: bee11624 b7cfd348 [heap] 2021-11-12 02:33:41.644 651-651/? I/DEBUG: memory near r0: 2021-11-12 02:33:41.654 1382-1384/com.android.launcher D/dalvikvm: GC_CONCURRENT freed 4679K, 41% free 11051K/18695K, paused 62ms+6ms, total 249ms 2021-11-12 02:33:41.654 651-651/? I/DEBUG: b7cfd398 64766b6d 2f6f6d65 656c6966 6d6d2f73 mkvdemo/files/mm 2021-11-12 02:33:41.654 1382-1625/com.android.launcher D/dalvikvm: WAIT_FOR_CONCURRENT_GC blocked 145ms 2021-11-12 02:33:41.664 651-651/? I/DEBUG: b7cfd3a8 6200766b 37762d69 454e2f61 0000003b kv.bi-v7a/NE;... 2021-11-12 02:33:41.664 651-651/? I/DEBUG: b7cfd3b8 7461642f 61642f61 632f6174 742e6d6f /data/data/com.t 2021-11-12 02:33:41.664 651-651/? I/DEBUG: b7cfd3c8 65636e65 6d2e746e 64766b6d 2f6f6d65 encent.mmkvdemo/ 2021-11-12 02:33:41.664 651-651/? I/DEBUG: b7cfd3d8 656c6966 6d6d2f73 0000766b 00000000 files/mmkv...... 2021-11-12 02:33:41.664 651-651/? I/DEBUG: memory near r1: 2021-11-12 02:33:41.664 651-651/? I/DEBUG: b7cfd388 632f6174 742e6d6f 65636e65 6d2e746e ta/com.tencent.m 2021-11-12 02:33:41.664 651-651/? I/DEBUG: b7cfd398 64766b6d 2f6f6d65 656c6966 6d6d2f73 mkvdemo/files/mm 2021-11-12 02:33:41.674 651-651/? I/DEBUG: b7cfd3a8 6200766b 37762d69 454e2f61 0000003b kv.bi-v7a/NE;... 2021-11-12 02:33:41.674 651-651/? I/DEBUG: b7cfd3b8 7461642f 61642f61 632f6174 742e6d6f /data/data/com.t 2021-11-12 02:33:41.674 651-651/? I/DEBUG: b7cfd3c8 65636e65 6d2e746e 64766b6d 2f6f6d65 encent.mmkvdemo/ 2021-11-12 02:33:41.674 651-651/? I/DEBUG: memory near r4: 2021-11-12 02:33:41.674 651-651/? I/DEBUG: a594d090 00000000 00000000 00000000 00000000 ................ 2021-11-12 02:33:41.674 651-651/? I/DEBUG: a594d0a0 00000000 00000000 00000000 00000000 ................ 2021-11-12 02:33:41.684 651-651/? I/DEBUG: a594d0b0 b6fb4a4c a594e2dc a594e320 a594e368 LJ...... ...h... 2021-11-12 02:33:41.684 651-651/? I/DEBUG: a594d0c0 a58fda39 a594bf30 a5930019 a594bf1c 9...0........... 2021-11-12 02:33:41.684 651-651/? I/DEBUG: a594d0d0 a594e314 a58fff63 a594e30c a594e310 ....c........... 2021-11-12 02:33:41.684 651-651/? I/DEBUG: memory near r5: 2021-11-12 02:33:41.684 651-651/? I/DEBUG: b7beb9c0 00000000 00000000 00000000 00000000 ................ 2021-11-12 02:33:41.694 651-651/? I/DEBUG: b7beb9d0 00000000 00000000 00000000 00000453 ............S... 2021-11-12 02:33:41.694 651-651/? I/DEBUG: b7beb9e0 a96eb454 ab62acc4 aa8cc718 a594f000 T.n...b......... 2021-11-12 02:33:41.694 651-651/? I/DEBUG: b7beb9f0 00000001 9bbacc62 bee11850 00000000 ....b...P....... 2021-11-12 02:33:41.694 651-651/? I/DEBUG: b7beba00 bee11884 00000001 00000000 b685afc0 ................ 2021-11-12 02:33:41.704 651-651/? I/DEBUG: memory near r7: 2021-11-12 02:33:41.704 651-651/? I/DEBUG: bee11658 bee11678 a5903c9d a594d0b0 0000002a x....<......... 2021-11-12 02:33:41.704 651-651/? I/DEBUG: bee11668 b7cfd348 a594e314 bee116e0 9bbacc62 H...........b... 2021-11-12 02:33:41.704 651-651/? I/DEBUG: bee11678 bee116a0 a5903c1d bee116a0 a5900339 .....<......9... 2021-11-12 02:33:41.704 651-651/? I/DEBUG: bee11688 bee116a0 0000002a a594e314 a594e314 ............... 2021-11-12 02:33:41.714 651-651/? I/DEBUG: bee11698 00000001 bee116e0 bee116f8 a58fe45b ............[... 2021-11-12 02:33:41.714 651-651/? I/DEBUG: memory near r8: 2021-11-12 02:33:41.714 651-651/? I/DEBUG: bee116e4 0000002a b7cfd348 9bbacc62 aa8ccd70 ...H...b...p... 2021-11-12 02:33:41.714 651-651/? I/DEBUG: bee116f4 00000000 ab62acd0 b685ae34 00000001 ......b.4....... 2021-11-12 02:33:41.714 651-651/? I/DEBUG: bee11704 b68858a3 ab62acc4 00000001 aebe5ae8 .X....b......Z.. 2021-11-12 02:33:41.714 651-651/? I/DEBUG: bee11714 a5dd263e aebbfe74 b6889e6b ab62acc4 >&..t...k.....b. 2021-11-12 02:33:41.714 651-651/? I/DEBUG: bee11724 a5dd263a a58fe409 b7beb9f0 c8c00019 :&.............. 2021-11-12 02:33:41.724 651-651/? I/DEBUG: memory near r9: 2021-11-12 02:33:41.724 651-651/? I/DEBUG: ab62aca4 00000000 00000001 aebe56e8 ab62ace4 .........V....b. 2021-11-12 02:33:41.724 651-651/? I/DEBUG: ab62acb4 a5ba77fa aa8ccd70 00000006 00000000 .w..p........... 2021-11-12 02:33:41.734 651-651/? I/DEBUG: ab62acc4 4c20001d 79300021 00000001 ab62ad18 .. L!.0y......b. 2021-11-12 02:33:41.734 651-651/? I/DEBUG: ab62acd4 a5ba7a3a aa8cc718 a5ba77fa 00000000 :z.......w...... 2021-11-12 02:33:41.734 651-651/? I/DEBUG: ab62ace4 00000001 aebe6ba0 00000000 aebe6c28 .....k......(l.. 2021-11-12 02:33:41.734 651-651/? I/DEBUG: memory near sl: 2021-11-12 02:33:41.734 651-651/? I/DEBUG: b7beb9d0 00000000 00000000 00000000 00000453 ............S... 2021-11-12 02:33:41.734 651-651/? I/DEBUG: b7beb9e0 a96eb454 ab62acc4 aa8cc718 a594f000 T.n...b......... 2021-11-12 02:33:41.734 651-651/? I/DEBUG: b7beb9f0 00000001 9bbacc62 bee11850 00000000 ....b...P....... 2021-11-12 02:33:41.744 651-651/? I/DEBUG: b7beba00 bee11884 00000001 00000000 b685afc0 ................ 2021-11-12 02:33:41.744 651-651/? I/DEBUG: b7beba10 00000000 00000000 aa05f570 ab625300 ........p....Sb. 2021-11-12 02:33:41.744 651-651/? I/DEBUG: memory near fp: 2021-11-12 02:33:41.744 651-651/? I/DEBUG: bee116fc b685ae34 00000001 b68858a3 ab62acc4 4........X....b. 2021-11-12 02:33:41.744 651-651/? I/DEBUG: bee1170c 00000001 aebe5ae8 a5dd263e aebbfe74 .....Z..>&..t... 2021-11-12 02:33:41.754 651-651/? I/DEBUG: bee1171c b6889e6b ab62acc4 a5dd263a a58fe409 k.....b.:&...... 2021-11-12 02:33:41.754 651-651/? I/DEBUG: bee1172c b7beb9f0 c8c00019 00000000 b7beb9e0 ................ 2021-11-12 02:33:41.754 651-651/? I/DEBUG: bee1173c b6fb4a4c bee117a8 00000000 ab62ac9c LJ............b. 2021-11-12 02:33:41.754 651-651/? I/DEBUG: memory near sp: 2021-11-12 02:33:41.754 651-651/? I/DEBUG: bee115b8 bee1171c b7cfd3b8 b7cfd3b8 b6f86a7d ............}j.. 2021-11-12 02:33:41.754 651-651/? I/DEBUG: bee115c8 a594d0b0 b7beb9e0 df0027ad 00000000 .........'...... 2021-11-12 02:33:41.764 651-651/? I/DEBUG: bee115d8 a594e315 ffffffef 0000002a 00000020 ........... ... 2021-11-12 02:33:41.764 651-651/? I/DEBUG: bee115e8 0000000a a594e314 00e11618 00000014 ................ 2021-11-12 02:33:41.764 651-651/? I/DEBUG: bee115f8 0000002a b7cfd3b8 a594e314 a594d0b0 ............... 2021-11-12 02:33:41.764 651-651/? I/DEBUG: code around pc: 2021-11-12 02:33:41.764 651-651/? I/DEBUG: a5923b48 00029586 466fb580 4962b0a8 68094479 ......oF..bIyD.h 2021-11-12 02:33:41.774 651-651/? I/DEBUG: a5923b58 91276809 980a900a f85cf7da e80ef7d9 .h'............ 2021-11-12 02:33:41.774 651-651/? I/DEBUG: a5923b68 efc09009 20640050 460aa90c 0ac0f942 ....P.d ...FB... 2021-11-12 02:33:41.774 651-651/? I/DEBUG: a5923b78 60102000 0250f101 0acff942 0240f101 . .`[email protected] 2021-11-12 02:33:41.774 651-651/? I/DEBUG: a5923b88 0acff942 0230f101 0acff942 0220f101 B.....0.B..... . 2021-11-12 02:33:41.774 651-651/? I/DEBUG: code around lr: 2021-11-12 02:33:41.784 651-651/? I/DEBUG: b6f86a5c e7f14613 4606b570 eb36f7f4 46281c45 .F..p..F..6.E.(F 2021-11-12 02:33:41.784 651-651/? I/DEBUG: b6f86a6c fa56f7f4 b1184604 462a4631 eb78f7eb ..V..F..1FF..x. 2021-11-12 02:33:41.784 651-651/? I/DEBUG: b6f86a7c bd704620 f44fb510 4c037280 4621447c Fp...O..r.L|D!F 2021-11-12 02:33:41.784 651-651/? I/DEBUG: b6f86a8c f804f000 bd104620 00027c20 43f8e92d .... F.. |..-..C 2021-11-12 02:33:41.784 651-651/? I/DEBUG: b6f86a9c 46064615 f7f0460c 2200ff35 4b296803 .F.F.F..5..".h)K 2021-11-12 02:33:41.784 651-651/? I/DEBUG: memory map around fault addr a5923b6a: 2021-11-12 02:33:41.794 651-651/? I/DEBUG: (no map below) 2021-11-12 02:33:41.794 651-651/? I/DEBUG: a58d2000-a594b000 /data/data/com.tencent.mmkvdemo/lib/libmmkv.so 2021-11-12 02:33:41.794 651-651/? I/DEBUG: a594b000-a594e000 /data/data/com.tencent.mmkvdemo/lib/libmmkv.so 2021-11-12 02:33:41.984 890-1006/system_process I/qtaguid: Failed write_ctrl(s 0 10044) res=-1 errno=1 2021-11-12 02:33:41.984 890-1006/system_process W/NetworkManagementSocketTagger: setKernelCountSet(10044, 0) failed with errno -1 2021-11-12 02:33:41.984 890-1076/system_process I/ActivityManager: Process com.tencent.mmkvdemo (pid 1755) has died. 2021-11-12 02:33:41.994 890-1076/system_process W/ActivityManager: Force removing ActivityRecord{aec2f748 com.tencent.mmkvdemo/.MainActivity}: app died, no saved state 2021-11-12 02:33:42.014 654-654/? D/Zygote: Process 1755 terminated by signal (4) 2021-11-12 02:33:42.144 1382-1382/com.android.launcher D/EGL_emulation: eglMakeCurrent: 0xb7dda768: ver 2 0 2021-11-12 02:33:42.144 1382-1382/com.android.launcher E/EGL_emulation: tid 1382: eglSurfaceAttrib(1199): error 0x3009 (EGL_BAD_MATCH) 2021-11-12 02:33:42.144 1382-1382/com.android.launcher W/HardwareRenderer: Backbuffer cannot be preserved

    opened by JustinLance 6
  • Can not generate IPA when adding 'MMKVWatchExtension' (ipatool failed with an exception)

    Can not generate IPA when adding 'MMKVWatchExtension' (ipatool failed with an exception)

    The language of MMKV

    • Objective-C, Swift

    The version of MMKV

    • 1.2.10

    The platform of MMKV

    • iOS & WatchOS

    The installation of MMKV

    • Cocoapods 1.10.0

    What's the issue?

    • I'm getting this error when trying to create IPA build for my application (iOS and WatchOS targets): ipatool failed with an exception: #<CmdSpec::NonZeroExitException: .... (Full log in Xcode Distribution Logs)
    • Everything working normally with MMKV for iOS, the error just appears when adding MMKVWatchExtension to the Watch Extension target.

    What's the log of MMKV when that happened?

    Screen Shot 2021-08-30 at 20 15 47 - XCode Distribution Logs: [xcdistributionlogs.zip](https://github.com/Tencent/MMKV/files/7077412/xcdistributionlogs.zip)

    Note: I tried to uncheck Rebuild from Bitcode and it can generate the IPA file. But afraid it will be rejected by Apple, because Bitcode is the default for WatchOS.

    This is my pod file:

    target 'TestingWatch-Tarrget' do
      use_frameworks!
      pod 'MMKV', '1.2.10'
    end
    
    target 'Watch-Demo' do
      use_frameworks!
    end
    
    target 'Watch-Demo Extension' do
      use_frameworks!
      pod 'MMKVWatchExtension', '1.2.10'
    end
    
    • Here are what I tried but still getting the error:
    • [x] BUILD_LIBRARY_FOR_DISTRIBUTION must be set to YES
    • [x] SKIP_INSTALL must be set to NO
    • [x] GCC_INSTRUMENT_PROGRAM_FLOW_ARCS = NO
    • [x] CLANG_ENABLE_CODE_COVERAGE = NO to turn off code coverage tools from the binary
    opened by canhth 13
  • std::out_of_range

    std::out_of_range

    The language of MMKV

    Objective-C

    The version of MMKV

    v1.2.8

    The platform of MMKV

    iOS

    The installation of MMKV

    Cocoapods

    What's the issue?

    #0 Thread

    std::out_of_range

    (null)

    解析原始 0 libc++abi.dylib 0x00000001b4022000 + 77728 2 libc++abi.dylib 0x00000001b4022000 + 89016 3 MyAPP mmkv::CodedInputDataCrypt::readString(mmkv::KeyValueHolderCrypt&) (CodedInputDataCrypt_OSX.cpp:0) 4 MyAPP _ZZN4mmkv11MiniPBCoder12decodeOneMapERNSt3__113unordered_mapIP8NSStringNS_19KeyValueHolderCryptENS_9KeyHasherENS_10KeyEqualerENS1_9allocatorINS1_4pairIKS4_S5_EEEEEEmbENK3$1clESE (MiniPBCoder_OSX.cpp:140) 5 MyAPP mmkv::MiniPBCoder::decodeOneMap(std::__1::unordered_map<NSString*, mmkv::KeyValueHolderCrypt, mmkv::KeyHasher, mmkv::KeyEqualer, std::__1::allocator<std::__1::pair<NSString* const, mmkv::KeyValueHolderCrypt> > >&, unsigned long, bool) (unordered_map:1268) 6 MyAPP mmkv::MiniPBCoder::decodeMap(std::__1::unordered_map<NSString*, mmkv::KeyValueHolderCrypt, mmkv::KeyHasher, mmkv::KeyEqualer, std::__1::allocator<std::__1::pair<NSString* const, mmkv::KeyValueHolderCrypt> > >&, mmkv::MMBuffer const&, mmkv::AESCrypt*, unsigned long) (MiniPBCoder.cpp:53) 7 MyAPP mmkv::MMKV::loadFromFile() (MMKV_IO.cpp:105) 8 MyAPP mmkv::MMKV::checkLoadData() (MMKV_IO.cpp:0) 9 MyAPP mmkv::MMKV::getDataForKey(NSString*) (MMKV_IO.cpp:468) 10 MyAPP mmkv::MMKV::getBool(NSString*, bool) (MMBuffer.h:83)

    opened by Designerxsh 19
Releases(v1.2.13)
  • v1.2.13(Mar 30, 2022)

    v1.2.13 / 2022-03-30

    Android

    • Fix crash on using Ashmem while MMKV_DISABLE_CRYPT macro is defined.

    iOS

    • Add ability to retrieve key existece while getting value, aka -[MMKV getXXX:forKey:hasValue:] methods.

    POSIX

    • Add ability to retrieve key existece while getting value, aka MMKV::getXXX(key, defaultValue, hasValue) methods.

    Win32

    • Add ability to retrieve key existece while getting value, aka MMKV::getXXX(key, defaultValue, hasValue) methods.
    Source code(tar.gz)
    Source code(zip)
  • v1.2.12(Jan 17, 2022)

    v1.2.12 / 2022-01-17

    Changes for All platforms

    • Fix a bug that a subsequential clearAll() call may fail to take effect in multi-process mode.
    • Hide some OpenSSL symbols to prevent link-time symbol conflict, when an App somehow also static linking OpenSSL.

    Android

    • Upgrade compileSdkVersion & targetSdkVersion from 30 to 31.
    Source code(tar.gz)
    Source code(zip)
  • v1.2.11(Oct 26, 2021)

    v1.2.11 / 2021-10-26

    Android

    • Due to increasing report about crash inside STL, we have decided to make MMKV static linking libc++ by default. Starting from v1.2.11, com.tencent:mmkv-static is the same as com.tencent:mmkv.
    • For those still in need of MMKV with shared linking of libc++_shared, you could use com.tencent:mmkv-shared instead.
    • Add backup & restore ability.

    iOS / macOS

    • Add backup & restore ability.
    • Support tvOS.
    • Fix a compile error on some old Xcode.

    Flutter (v1.2.12)

    • Add backup & restore ability.

    POSIX / golang / Python

    • Add backup & restore ability.
    • Fix a compile error on Gentoo.

    Win32

    • Add backup & restore ability.
    Source code(tar.gz)
    Source code(zip)
  • v1.2.10(Jun 25, 2021)

    v1.2.10 / 2021-06-25

    This version is mainly for Android & Flutter.

    Android

    • Complete JavaDoc documentation for all public methods, classes, and interfaces. From now on, you can find the API reference online.
    • Drop the support of armeabi arch. Due to some local build cache mistake, the last version (v1.2.9) of MMKV still has an unstripped armeabi arch inside. This is fixed.
    • Change MMKV.mmkvWithID() from returning null to throwing exceptions on any error.
    • Add MMKV.actualSize() to get the actual used size of the file.
    • Mark MMKV.commit() & MMKV.apply() as deprecated, to avoid some misuse after migration from SharedPreferences to MMKV.

    Flutter (v1.2.11)

    • Bug Fixed: When building on iOS, occasionally it will fail on symbol conflict with other libs. We have renamed all public native methods to avoid potential conflict.
    • Keep up with MMKV native lib v1.2.10.
    Source code(tar.gz)
    Source code(zip)
  • v1.2.9(May 26, 2021)

    v1.2.9 / 2021-05-26

    This version is mainly for Android & Flutter.

    Android

    • Drop the support of armeabi arch. As has been mention in the last release, to avoid some crashes on the old NDK (r16b), and make the most of a more stable libc++, we have decided to upgrade MMKV's building NDK in this release. That means we can't support armeabi anymore. Those who still in need of armeabi can build from sources by following the instruction in the wiki.

    We really appreciate your understanding.

    Flutter (v1.2.10)

    • Bug Fixed: When calling MMKV.encodeString() with an empty string value on Android, MMKV.decodeString() will return null.
    • Bug Fixed: After upgrading from Flutter 1.20+ to 2.0+, calling MMKV.defaultMMKV() on Android might fail to load, you can try calling MMKV.defaultMMKV(cryptKey: '\u{2}U') with an encrytion key '\u{2}U' instead.
    • Keep up with MMKV native lib v1.2.9.
    Source code(tar.gz)
    Source code(zip)
  • v1.2.8(May 6, 2021)

    v1.2.8 / 2021-05-06

    This will be the last version that supports armeabi arch on Android. To avoid some crashed on the old NDK (r16b), and make the most of a more stable libc++, we have decided to upgrade MMKV's building NDK in the next release. That means we can't support armeabi anymore.

    We really appreciate your understanding.

    Android

    • Migrate MMKV to Maven Central Repository. For versions older than v1.2.7 (including), they are still available on JCenter.
    • Add MMKV.disableProcessModeChecker(). There are some native crash reports due to the process mode checker. You can disable it manually.
    • For the same reason described above (native crashed), MMKV will now turn off the process mode checker on a non-debuggable app (aka, a release build).
    • For MMKV to detect whether the app is debuggable or not, when calling MMKV.initialize() to customize the root directory, a context parameter is required now.

    iOS / macOS

    • Min iOS support has been upgrade to iOS 9.
    • Support building by Xcode 12.

    Flutter

    • Support null-safety.
    • Upgrade to flutter 2.0.
    • Fix a crash on the iOS when calling encodeString() with an empty string value.

    Known Issue on Flutter

    • When calling encodeString() with an empty string value on Android, decodeString() will return null. This bug will be fixed in the next version of Android Native Lib. iOS does not have such a bug.

    Win32

    • Fix a compile error on Visual Studio 2019.
    Source code(tar.gz)
    Source code(zip)
  • v1.2.7(Dec 25, 2020)

    v1.2.7 / 2020-12-25

    Happy holidays everyone!

    Changes for All platforms

    • Fix a bug when calling sync() with false won't do msync() asynchronous and won't return immediately.

    Android

    • Fix an null pointer exception when calling putStringSet() with null.
    • Complete review of all MMKV methods about Java nullable/nonnull annotation.
    • Add API for MMKV.initialize() with both Context and LibLoader parammeters.

    Flutter

    • Fix a crash on the iOS simulator when accessing the default MMKV instance.
    • Fix a bug on iOS when initing the default MMKV instance with a crypt key, the instance is still in plaintext.

    Golang

    Add golang for POSIX platforms. Most things actually work!. Check out the wiki for information.

    Source code(tar.gz)
    Source code(zip)
  • v1.2.6-golang(Dec 17, 2020)

  • v1.2.6(Nov 27, 2020)

    v1.2.6 / 2020-11-27

    Changes for All platforms

    • Fix a file corruption when calling reKey() after removeKeys() has just been called.

    Android

    • Fix compile error when MMKV_DISABLE_CRYPT is set.
    • Add a preprocess directive MMKV_DISABLE_FLUTTER to disable flutter plugin features. If you integrate MMKV by source code, and if you are pretty sure the flutter plugin is not needed, you can turn that off to save some binary size.

    Flutter

    Add MMKV support for Flutter on iOS & Android platform. Most things actually work!
    Check out the wiki for more info.

    Source code(tar.gz)
    Source code(zip)
  • v1.2.5(Nov 13, 2020)

    v1.2.5 / 2020-11-13

    This is a pre-version for Flutter. The official Flutter plugin of MMKV will come out soon. Stay Tune!

    iOS / macOS

    • Fix an assert error of encrypted MMKV when encoding some <NSCoding> objects.
    • Fix a potential leak when decoding duplicated keys from the file.
    • Add +[MMKV pageSize], +[MMKV version] methods.
    • Add +[MMKV defaultMMKVWithCryptKey:], you can encrypt the default MMKV instance now, just like the Android users who already enjoy this for a long time.
    • Rename -[MMKV getValueSizeForKey:] to -[MMKV getValueSizeForKey: actualSize:] to align with Android interface.

    Android

    • Fix a potential crash when getting MMKV instances in multi-thread at the same time.
    • Add MMKV.version() method.
    Source code(tar.gz)
    Source code(zip)
  • v1.2.4(Oct 21, 2020)

    v1.2.4 / 2020-10-21

    This is a hotfix mainly for iOS.

    iOS / macOS

    • Fix a decode error of encrypted MMKV on some devices.

    Android

    • Fix a potential issue on checking rootDir in multi-thread while MMKV initialization is not finished.
    Source code(tar.gz)
    Source code(zip)
  • v1.2.3(Oct 16, 2020)

    v1.2.3 / 2020-10-16

    Changes for All platforms

    • Fix a potential crash on 32-bit devices due to pointer alignment issue.
    • Fix a decode error of encrypted MMKV on some 32-bit devices.

    iOS / macOS

    • Fix a potential crc32() crash on some kind of arm64 devices.
    • Fix a potential crash after calling +[MMKV onAppTerminate].

    Android

    • Fix a rare lock conflict on checkProcessMode().

    POSIX

    Add MMKV support for Python on POSIX platforms. Most things actually work!
    Check out the wiki for more info.

    Source code(tar.gz)
    Source code(zip)
  • v1.2.2-python(Sep 2, 2020)

  • v1.2.2(Aug 2, 2020)

    v1.2.2 / 2020-07-30

    iOS / macOS

    • Add auto clean up feature. Call +[MMKV enableAutoCleanUp:] to enable auto cleanup MMKV instances that not been accessed recently.
    • Fix a potential crash on devices under iPhone X.

    Android

    • Add multi-process mode check. After so many issues had been created due to mistakenly using MMKV in multi-process mode in Android, this check is added. If an MMKV instance is accessed with SINGLE_PROCESS_MODE in multi-process, an IllegalArgumentException will be thrown.

    POSIX

    • Add support for armv7 & arm64 arch on Linux.
    Source code(tar.gz)
    Source code(zip)
  • v1.2.1(Jul 3, 2020)

    v1.2.1 / 2020-07-03

    This is a hotfix version. Anyone who has upgraded to v1.2.0 should upgrade to this version immediately.

    • Fix a potential file corruption bug when writing a file that was created in versions older than v1.2.0. This bug was introduced in v1.2.0.
    • Add a preprocess directive MMKV_DISABLE_CRYPT to turn off MMKV encryption ability once and for all. If you integrate MMKV by source code, and if you are pretty sure encryption is not needed, you can turn that off to save some binary size.
    • The parameter relativePath (customizing a separate folder for an MMKV instance), has been renamed to rootPath. Making it clear that an absolute path is expected for that parameter.

    iOS / macOS

    • -[MMKV mmkvWithID: relativePath:] is deprecated. Use -[MMKV mmkvWithID: rootPath:] instead.
    • Likewise, -[MMKV mmkvWithID: cryptKey: relativePath:] is deprecated. Use -[MMKV mmkvWithID: cryptKey: rootPath:] instead.
    Source code(tar.gz)
    Source code(zip)
  • v1.2.0(Jul 2, 2020)

    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 from malloc() & 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.
    Source code(tar.gz)
    Source code(zip)
  • v1.1.2(May 29, 2020)

    v1.1.2 / 2020-05-29

    Android / iOS & macOS / Win32 / POSIX

    • Fix a potential crash after trim() a multi-process MMKV instance.
    • Improve clearAll() a bit.
    Source code(tar.gz)
    Source code(zip)
  • v1.1.1(Apr 13, 2020)

    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 the MainActivity class.

    POSIX

    • Fix two compile errors with some compilers.
    Source code(tar.gz)
    Source code(zip)
  • v1.1.0(Mar 26, 2020)

    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 like MMKVLogLevel.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 on armeabi & 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.
    Source code(tar.gz)
    Source code(zip)
  • v1.0.24(Jan 17, 2020)

    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 accessing UIApplicationState 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.
    Source code(tar.gz)
    Source code(zip)
  • v1.0.23(Sep 3, 2019)

    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 default HashSet<String>, check decodeStringSet() 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.
    Source code(tar.gz)
    Source code(zip)
  • v1.0.22(Jun 10, 2019)

    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.
    Source code(tar.gz)
    Source code(zip)
  • v1.0.20(Jun 5, 2019)

    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.
    Source code(tar.gz)
    Source code(zip)
  • v1.0.19(Apr 22, 2019)

    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(), or void apply() that comes with SharedPreferences.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.
    Source code(tar.gz)
    Source code(zip)
  • v1.0.18(Mar 14, 2019)

    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.
    Source code(tar.gz)
    Source code(zip)
  • v1.0.17(Jan 25, 2019)

    v1.0.17 / 2019-01-25

    iOS / macOS

    What's new

    • Redirect logging of MMKV is supported now.
    • Dynamically disable logging of MMKV is supported now.
    • Add method migrateFromUserDefaults to import from NSUserDefaults.

    Android

    What's new

    • Redirect logging of MMKV is supported now.
    • Dynamically disable logging of MMKV is supported now.
      Note: These two are breaking changes for interface MMKVHandler, update your implementation with wantLogRedirecting() & mmkvLog() for v1.0.17. (Interface with default method requires API level 24, sigh...)
    • Add option to use custom library loader initialize(String rootDir, LibLoader loader). If you're facing System.loadLibrary() crash on some low API level device, consider using ReLinker to load MMKV. Example can be found in mmkvdemo.
    • Fix a potential corruption of meta file on multi-process mode.
    • Fix a potential crash when the meta file is not valid on multi-process mode.

    Win32

    • Redirect logging of MMKV is supported now.
    • Dynamically disable logging of MMKV is supported now.
    • Fix a potential corruption of meta file on multi-process mode.
    Source code(tar.gz)
    Source code(zip)
  • v1.0.16(Jan 4, 2019)

    v1.0.16 / 2019-01-04

    iOS / macOS

    What's new

    • Customizing root folder of MMKV is supported now.
    • Customizing folder for specific MMKV is supported now.
    • Add method getValueSizeForKey: to get value's size of a key.

    Android

    What's new

    • Customizing root folder of MMKV is supported now.
    • Customizing folder for specific MMKV is supported now.
    • Add method getValueSizeForKey() to get value's size of a key.
    • Fix a potential crash when the meta file is not valid.

    Win32

    MMKV for Windows is released now. Most things actually work!

    Source code(tar.gz)
    Source code(zip)
  • v1.0.15(Dec 14, 2018)

    v1.0.15 / 2018-12-13

    iOS / macOS

    What's new

    • Storing NSString/NSData/NSDate directly by calling setString/getSring, setData/getData, setDate/getDate.
    • Fix a potential crash due to divided by zero.

    Android

    What's new

    • Fix a stack overflow crash due to the callback feature introduced by v1.0.13.
    • Fix a potential crash due to divided by zero.

    Win32

    MMKV for Win32 in under construction. Hopefully will come out in next release. For those who are interested, check out branch dev_win32 for the latest development.

    Source code(tar.gz)
    Source code(zip)
  • v1.0.14(Nov 30, 2018)

    v1.0.14 / 2018-11-30

    iOS / macOS

    What's new

    • Setting nil value to reset a key is supported now.
    • Rename boolValue(forKey:) to bool(forKey:) for Swift.

    Android

    What's new

    • Parcelable objects can be stored directly into MMKV now.
    • Setting null value to reset a key is supported now.
    • Fix an issue that MMKV's file size might expand unexpectly large in some case.
    • Fix an issue that MMKV might crash on multi-thread removing and getting on the same key.
    Source code(tar.gz)
    Source code(zip)
  • v1.0.13(Nov 14, 2018)

    v1.0.13 / 2018-11-09

    iOS / macOS

    What's new

    • Special chars like / are supported in MMKV now. The file name of MMKV with special mmapID will be encoded with md5 and stored in seperate folder.
    • Add callback for MMKV error handling. You can make MMKV to recover instead of discard when crc32 check fail happens.
    • Add trim and close operation. Generally speaking they are not necessary in daily usage. Use them if you worry about disk / memory / fd usage.
    • Fix an issue that MMKV's file size might expand unexpectly large in some case.

    Known Issues

    • Setting nil value to reset a key will be ignored. Use remove instead.

    Android

    What's new

    • Add static linked of libc++ to trim AAR size. Use it when there's no other lib in your App embeds libc++_shared.so. Or if you already have an older version of libc++_shared.so that doesn't agree with MMKV.
      Add implementation 'com.tencent:mmkv-static:1.0.13' to your App's gradle setting to integrate.
    • Special chars like / are supported in MMKV now. The file name of MMKV with special mmapID will be encoded with md5 and stored in seperate folder.
    • Add callback for MMKV error handling. You can make MMKV to recover instead of discard when crc32 check fail happens.
    • Add trim and close operation. Generally speaking they are not necessary in daily usage. Use them if you worry about disk / memory / fd usage.

    Known Issues

    • Setting null value to reset a key will be ignored. Use remove instead.
    • MMKV's file size might expand unexpectly large in some case.
    Source code(tar.gz)
    Source code(zip)
Owner
Tencent
Tencent
Filament is a real-time physically based rendering engine for Android, iOS, Windows, Linux, macOS, and WebGL2

Filament Filament is a real-time physically based rendering engine for Android, iOS, Linux, macOS, Windows, and WebGL. It is designed to be as small a

Google 14.3k Jul 1, 2022
A cross-platform (Android/iOS/Windows/macOS) cronet plugin for Flutter via `dart:ffi`

cronet_flutter A cross-platform (Android/iOS/Windows/macOS) cronet plugin for Flutter via dart:ffi

null 20 Jun 15, 2022
John Walker 15 Jun 16, 2022
Spacex Storage is an offchain storage work inspector of Mannheim Network running inside TEE enclave.

Spacex Storage Spacex Storage is an offchain storage work inspector of Mannheim Network running inside TEE enclave. Contribution Thank you for conside

Mannheim Network 8 Mar 22, 2022
A customized LGL Android mod menu, containing ESP only for PUBG Mobile 1.3.0 for Android

PUBG Mobile ESP Mod Menu A customized LGL mod menu, containing ESP only for PUBG Mobile 1.3.0 for Android. Everything are fixed so it works with both

null 42 Mar 19, 2022
Oxygine is C++ engine and framework for 2D games on iOS, Android, Windows, Linux and Mac

BUILD AND RUN See oxygine-framework/readme/ folder. It has instructions on how to build and run oxygine on different platforms. Wiki available at http

Oxygine 728 Jun 17, 2022
📃 Export WeChat chat histories to HTML files.

wechat-export Export WeChat chat histories to HTML files. Preview This script generates a HTML file for each contact's chat history. Currently it supp

Zihua Li 563 Jun 27, 2022
A high performance, shared memory, lock free, cross platform, single file, no dependencies, C++11 key-value store

SimDB A high performance, shared memory, lock free, cross platform, single file, no dependencies, C++11 key-value store. SimDB is part of LAVA (Live A

null 442 Jun 25, 2022
Fix some extrinsic parameter importing problems. 6-axis IMU works now. Lidar without ring works now.

LVI-SAM-MODIFIED This repository is a modified version of LVI-SAM. Modification Add function to get extrinsic parameters.The original code assumes the

null 64 Jun 22, 2022
Sega Master System / Game Gear / SG-1000 emulator for iOS, macOS, Raspberry Pi, Windows, Linux, BSD and RetroArch.

Gearsystem is a very accurate, cross-platform Sega Master System / Game Gear / SG-1000 emulator written in C++ that runs on Windows, macOS, Linux, BSD, iOS, Raspberry Pi and RetroArch.

Ignacio Sanchez Gines 161 Jun 22, 2022
Allows to swap the Fn key and left Control key and other tweaks on Macbook Pro and Apple keyboards in GNU/Linux

A patched hid-apple kernel module UPDATE August 2020: swap_fn_leftctrl is now built-in in Linux 5.8 ?? UPDATE Jun 2020: New feature added (swap_fn_f13

Zakhar Semenov 295 Jun 23, 2022
PlotFS is a fuse filesystem for efficient storage of Chia plot files.

PlotFS PlotFS is a fuse filesystem for efficient storage of Chia plot files. PlotFS is not a traditional filesystem. It is mounted read only for farmi

Matthew Szatmary 44 Jun 20, 2022
⌨️ Personal key mapping for The Key.

The Key Personal key mapping for The Key. This firmware configures: The first key to be the mute key on single tap, and the pause/play key on double t

Zihua Li 1 Dec 25, 2021
Signed - a 3D modeling and construction language based on Lua and SDFs. Signed will be available for macOS and iOS and is heavily optimized for Metal.

Signed - A 3D modeling language Abstract Signed is a Lua based 3D modeling language, it provides a unique way to create high quality 3D content for yo

Markus Moenig 88 May 26, 2022
An easy to build CO2 Monitor/Meter with Android and iOS App for real time visualization and charting of air data, data logger, a variety of communication options (BLE, WIFI, MQTT, ESP-Now) and many supported sensors.

CO2-Gadget An easy to build CO2 Monitor/Meter with cell phone App for real time visualization and charting of air data, datalogger, a variety of commu

Mariete 19 Jun 23, 2022
minimal POSIX compliant sleep

Minimal POSIX compliant sleep. Results Only 3 syscalls per execution $ strace ./sleep 1 execve("./sleep", ["./sleep", "1"], 0x7ffc998d09a8 /* 40 vars

null 32 Jan 28, 2022
Simulate Linux Completely Fair Scheduler (CFS) using POSIX Threads

Linux CFS Simulator Simulate Linux Completely Fair Scheduler (CFS) using POSIX Threads. Build and Run $ make $ ./cfs-sim Note: The process status tabl

null 19 May 4, 2022
This program try to recreate bash --posix comportement in certain limite

minishell : petitcoquillage This program try to recreate bash --posix comportement in certain limite Execution : To execute this Program you have to b

null 50 Jun 21, 2022