SQLite Forum

Sd card mount/unmount
Login
> `sqlite3_close(db);`

You should check the return value of this call. If the returned value is not `SQLITE_OK`, the database isn't actually closed, and you have leaks of some other resources depending on `db` (e.g. prepared statements). See <https://sqlite.org/c3ref/close.html> for more information on that.

If you do get `SQLITE_OK` from `sqlite3_close`, consider using `lsof` or `fuser` to find out if there are any open filehandles on that filesystem. (On an embedded device, where you cannot use `lsof` or `fuser` because they don't fit in the image, you can iterate over `/proc/*/fd`. But this is an embedded Linux question, not an SQLite question.)