Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android data storage issue

Tags:

android

sqlite

I have an app which stores data in a SQLite database, when the app is just installed it uses 8kb of data and when I start inserting data obviously the size increases. The weird thing is when I start cleaning my database tables, I empty completely the database but I will never recover the first 8kb of data but much more, in some cases more than 100kb, where this data come from?

like image 461
user748492 Avatar asked May 11 '11 12:05

user748492


People also ask

Why is my Android phone storage full after deleting everything?

If your phone storage is full despite having space left on your SD card, this probably indicates your SD card is not set up as default internal storage. If so, your apps, files, and documents are stored by default in the device's internal storage. Go to settings>storage>SD Card.

Why am I running out of storage on my Android?

It is happening as your device's Random Access Memory (RAM) has run out. So deleting photos, videos and files to get some space on phone, will also boost the RAM. Most new Android phones have no option of SD card. So eventually, users get this message as all data gets piled up in phone memory.


1 Answers

A database is not like a filesystem, so when you delete data from a database, you do not recover the space you previously used. The database driver will tend to prefer to keep the old allocated space.

You can compact your database, which will recover this space by manually executing the SQLite VACUUM command.

It may be possible to enable auto_vacuum mode, but this needs to be done before database creation.

like image 169
RivieraKid Avatar answered Oct 06 '22 03:10

RivieraKid