-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ActualSize much less than real file size. #86
Comments
It's possible. It's not about how many items you store, but how big your items are. |
Should actualSize equals file size? |
No. |
And I don't recommend storing big data inside MMKV, at lease not in current release. |
Thank you. We didn't stored big date. |
That's weird. Can you send a reproducible demo project to me? guoling@tencent.com |
I don't know the reproduce step, I got the file from online gray version. The first line is like this, the actual size is same with valid data size. The last line is like this, which means “ "mRealTime":false}] ”, seems like the end of a string set. I am checking the value size key by key. |
By the way, why are you using |
It's a multi process App, I mean maybe we used SINGLE_PROCESS_MODE in some MULTI_PROCESS_MODE cases, By the way, the last value mentioned before is actually a Json String of List, is there any possible the calculate of Json size occurred error? |
Json is just a String, nothing special. Is there any chance that there're some big items stored in MMKV and deleted afterward? |
I am not very sure of that, need further check, what's the exact definition of "big"? |
Items with size of 10K+ is consider big. |
Do you mean remove big items would not trigger file resize? |
I think I have found the reason, the futureUsage is over estimated: My last value size is 130K, m_dic.size() is 1000+, then the file will resize to 130M, but most of it will never been used. This means, if I store thousands of keys in a file, it will very easy to cause OOM. |
Oh I see...Let me think about that. |
Fixed with this commit. |
I think it's good enough for me, thank you. How far will this release? By the way, I found there is no reduce file size operation except "clearAll", if I store a lot of key-values in one file and then delete most of them in some time, it seems will waste some disk space. Should I avoid this kind of usage as far as possible? |
That's a good suggestion. A And by the way, the next minor release is not on schedule yet. I'll let you know by commenting on this issue when that happens. |
Waiting for good news, thank you very much! |
Release with v1.0.13, check it out. |
Wonderful! |
It seems use average item size to calc future usage does not merge into android code. |
I can't believe these, looks like there's a mistake on my local git repo. |
Fixed with this commit. A new version will likely come out next week. |
Look forward to it, thank you. |
Released with v1.0.14. |
The language of MMKV
Java
The version of MMKV
v1.0.10
The platform of MMKV
Android
What's the issue?
OOM caused by mmkv file size too large.
loading [***] with file size 134217728, oldActualSize 6788724, newActualSize 6788839
Only 1000+ key-values occupies 130M.
What's the possible reason for actualSize much less than file size, multi-process read & write in single process mode?
The text was updated successfully, but these errors were encountered: