Could this have anything to do with my issue? https://sqlite.org/c3ref/db_release_memory.html Free Memory Used By A Database Connection int sqlite3_db_release_memory(sqlite3*); The sqlite3_db_release_memory(D) interface attempts to free as much heap memory as possible from database connection D. Unlike the sqlite3_release_memory() interface, this interface is in effect even when the SQLITE_ENABLE_MEMORY_MANAGEMENT compile-time option is omitted.