How to measure Android app data size and identify storage leaks?

Viewed 5177

I made a small Android app and have been using it for a while now. I noticed that, in the settings, on the "data" line of my app's characteristics (I am not interested in analysing the amount shown on the "application" line nor on the "cache" line), it shows about 20 MB, which seemed a lot to me. I am afraid the app has storage leaks (i.e. that it produces data that is never erased).

I decided to investigate and measure what might take that much space. I use pretty much all the available storage options for this app: SQLite DB, internal files, external files, shared preferences (and cache files including Glide picture loading).

So far, thanks to a question on SQLite DB, I found that my DB file takes about 500 kB. I found by scanning recursively the files and folders in the folder getFilesDir() that I use 10 kB of data in internal and app-private external files. I have not analysed Shared Preferences size yet, but I store less than 20 key/value pairs.

Exploring the folder getCacheDirs() I also found that Glide uses about 3 MB of cache (close to what the Android settings app tells).

My question is, which leads did I miss to find where this 19.5 MB of data I cannot locate? Did I forget some kind of storage that might take space? And, more generally, are there tools to analyse storage leaks (i.e. data produced by the app that might never be erased)?

4 Answers
Related