Skip to content

Conversation

@ferretwithaberet
Copy link

Adds additional information about MMKV being an in-memory store backed by mmap to avoid confusion. This gives more context for people that do not know what mmap or MMKV are or how they work.
I, personally, made the mistake of persisting tanstack query's cache with maxAge: Infinity to react-native-mmkv, without ever realizing that it is an in-memory store and that I am filling the RAM of my users' devices.

Adds additional information about MMKV being an in-memory store backed by `mmap` to avoid confusion.
This gives more context for people that do not know what `mmap` or `MMKV` are or how they work.
I, personally, made the mistake of persisting tanstack query's cache with `maxAge: Infinity` to `react-native-mmkv`, without ever realizing that it is an in-memory store and that I am filling the RAM of my users' devices.
@XChikuX
Copy link

XChikuX commented Nov 1, 2025

I agree. I didn't know the fetches were happening from RAM. Especially if all data is stored in ram without LRU cache. (not sure if this is how it works)

However, I think your explanation complicates understanding. @ferretwithaberet.

I'd prefer you keep the line:

  • MMKV is an efficient, small mobile key-value storage framework developed by WeChat. See Tencent/MMKV for more information

and add

Stored data is loaded onto memory using mmap and synced with the filesystem for persistence.

As an additional line. Please correct me if I've made any mistakes in understanding.

@LovesWorking
Copy link

Yea I did the same thing a few years ago!

@ferretwithaberet
Copy link
Author

ferretwithaberet commented Nov 5, 2025

I agree. I didn't know the fetches were happening from RAM. Especially if all data is stored in ram without LRU cache. (not sure if this is how it works)

However, I think your explanation complicates understanding. @ferretwithaberet.

I'd prefer you keep the line:

It's not meant to be the clearest description. I meant for it to bring the "in-memory" word in the user's face, this should raise some question marks and they will dig deeper (by clicking on the MMKV link hopefully).

* **MMKV** is an efficient, small mobile key-value storage framework developed by WeChat. See [Tencent/MMKV](https://github.com/Tencent/MMKV) for more information

and add

Stored data is loaded onto memory using mmap and synced with the filesystem for persistence.

As mentioned above, I'd rather keep the description small and concise with few important keywords. Users will likely tend to skip over long blocks of text so they might miss the information. I'd rather make the "in-memory" word bold, so they instantly see it. I also wanted to keep the "synced with files" part and the mmap mention so users get an ideea of how it works, I guess the mmap part could be omitted and mentioned somewhere else, but the "synced with files" part should stay, maybe just reworded.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants