For testing purposes you might want to have your code force a checkpoint at some point using <https://sqlite.org/c3ref/wal_checkpoint.html> and see whether this shrinks the WAL file as expected. If it doesn't, something is preventing checkpointing. Probably a _step() which is never terminated with _finalize() or _reset(). If it does then something weirder is going on. As explained elsewhere, the WAL file is a different file to the journal file. There's no way to limit the WAL file apart from checkpointing frequently.