I'm using sqlite in my app via the FMDB wrapper.
Memory usage in my app sits at 2.25 MB before a call to VACUUM:
[myFmdb executeUpdate: @"VACUUM;" ];
Afterwords its at 5.8 MB, and I can't seem to reclaim the memory. Post-vacuum, the Instruments/Allocations tool shows tons of sqlite3MemMalloc calls with live bytes, each allocating 1.5 K.
Short of closing the database and reopening it (an option), how can I clean this up?
Edit: closing and reopening the database connection does clear up the memory. This is my solution unless someone can shed some further insight to this.
I posted this question on the sqlite-users list and got a response that suggested reducing the cache size for sqlite. This is done by executing the following statement (adjusting the size value as desired):
EDIT: here's another nifty trick for releasing SQLite memory. Be sure to #define SQLITE_ENABLE_MEMORY_MANAGEMENT.
Documented here: http://www.sqlite.org/c3ref/release_memory.html