SQLite Forum

Wasted file space estimate
Login
You really shouldn't open() and close() SQLite database files using your
own code.   Use SQLite APIs only. The reason for this is that if another
thread in your application has the database open using SQLite, the close()
call you make will clear the posix advisor locks.  The SQLite connection
has no way to prevent or detect this.  Clearing locks out from under an
SQLite database connection could lead to database corruption.

A better solution would be to open the database using sqlite3_open() or
similar, and then run "PRAGMA page_size; PRAGMA freelist_count;" to get the
values you are looking for.