From 64035d3ecb93083c7b0baca664bbb4bc59cfcbe2 Mon Sep 17 00:00:00 2001 From: link2xt Date: Fri, 20 Oct 2023 02:11:21 +0000 Subject: [PATCH] fix: set soft_heap_limit on SQLite database This should prevent unlimited growth of memory usage by SQLite for is page cache. --- src/sql.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/sql.rs b/src/sql.rs index ceb38067e..521280f62 100644 --- a/src/sql.rs +++ b/src/sql.rs @@ -686,6 +686,7 @@ fn new_connection(path: &Path, passphrase: &str) -> Result { PRAGMA secure_delete=on; PRAGMA busy_timeout = 0; -- fail immediately PRAGMA temp_store=memory; -- Avoid SQLITE_IOERR_GETTEMPPATH errors on Android + PRAGMA soft_heap_limit = 8388608; -- 8 MiB limit, same as set in Android SQLiteDatabase. PRAGMA foreign_keys=on; ", )?;