3

update: the db-wal file is what is so large. what is the cause and how do i limit sqlite logging file size?

I am using a SQLiteOpenHelper. When onUpgrade occurs i am dropping every table that exists for my app. On the droid when i look at the applications data size using the settings app, you can see that the data size decreases like it should. But with the HTC Thunderbolt the data size does not decrease. What's worse is that the Thunderbolt's database continues to grow when you begin to use my app again. It appears as if the database will always grow on the Thunderbolt when i upgrade the database version.

I have verified that i am using only one database with the same name and that there was data in the database before i dropped the tables. I expect to see the same behavior on the Thunderbolt as i do on the droid. Is there any way i can programmatically clear all data for a device? This wouldn't be ideal, but it would be better than having the data size of the Thunderbolt always grow.

Paul Nikonowicz
  • 3,883
  • 21
  • 39

1 Answers1

1

If you are using a SQLiteOpenHelper, you need to call close when your application ends. The api docs mention that you do not need to call close on all of the SQLiteDatabase instances that are opened by it, but you still must call close on the Helper because it caches and tracks all open instances of SQLiteDatabase. Without calling close, the wal file will continue to grow for every different instance that getWriteableDatabase and getReadableDatabase return.

Paul Nikonowicz
  • 3,883
  • 21
  • 39