Closed shaifd closed 7 years ago
Hello @shaifd are you talking about high disk usage or memory (RAM) usage? For the remainder of my answers I will make a distinction between storage to the disk and memory. The latter, memory, is used when talking about RAM.
Extra information on the used native storage mechanisms: These mechanisms are loaded in memory in an initial phase. However, the documentation --of these mechanisms- don't state how this loading is done. So there remain questions such as: is part of the file loaded in memory and if there is some paging mechanisms, how does that work.
Extra information on Cordova: Apache Cordova will come with an increase of memory usage, as a result of its architecture.
What to do:
Getting the SharedPreference file in Android without root:
Thanks for the prompt response - I really appreciate it! Our app data is very small - no more than 1MB. But in the iPhone uder Settings > General > Storage & iCloud Usage > Manage Storage > the app, we see "Documents & Data" of more than 160MB and growing with each login since we started to use the NativeStorage plugin. Before this we used the localStorage and did not experience such issue. As far as I understand it means we refer to the disk usage.
As you suggested we checked the NSUserDefaults content - we see all our data is correctly stored with some other items and all in all it is less than 13KB, so we fail to understand the growing usage. We only access the storage with NativeStorage - no other plugin.
The only resources used by our plugin is the resources needed for the NSUserDefaults and SharedPreferences mechanisms. The increase in disk storage could also be caused by the usage of the Cordova framework related to plugins. However, this is just a guess. So maybe extra resources are allocated when using plugins, instead on relying on only the WebView of the platforms.
You should look at the application data, and see which files/Directories are created.
I'll keep this issue open for other developers who are experiencing the same. Or can contribute to this issue.
I am temporarily closing this issue because there was no activity here.
Would be happy to re-open if anyone faces this!
We converted our app from using localStorage to using native-storage after hearing from users with low-memory devices. Everything works well, function-wise, but we have noticed that there is a consistent storage increase every time we log into the app - for no apparent reason (iOS 10.1.1 iPhone 6S). We noticed about 1MB of storage for every login operation. During the login our app reads all the data we have in native-storage to memory (up to 100 keys at most) - and over-writes 3 keys - the size of all 100 keys including names, data - is much less than 1MB - and the 3 keys that are written are much less that 1KB.
Despite that - the storage taken by the App continue to grow - for no apparent reason. We have noticed somewhat similar situation in Android - there the growth seems smaller - and after a while the stored data seems to be truncated to a smaller size - so maybe it is using a cache that is cleared after a while in Android (and not in iOS).
Is there anything we can do to eliminate this behavior - either in code or in compile/build option?