I discovered that, when running mapserver, the world's sqlite database (when using write-ahead journaling) increases massively in size. (400MB originally -> 4GB.) When mapserver is running, the database connection stays active and prevents the WAL from being committed, leading to a massive journal. After killing mapserver and manually performing a checkpoint, the database goes back to its normal size.