From 2af3b0d333ea37cc40a1023f3fca5654c0e5488a Mon Sep 17 00:00:00 2001 From: Rene Cannao Date: Fri, 13 Feb 2026 12:04:34 +0000 Subject: [PATCH] Add notes about Valgrind and SQLite memory management Add comments to Makefile and deps/Makefile explaining that SQLite's internal memory allocator (enabled by SQLITE_ENABLE_MEMORY_MANAGEMENT) can cause false positives in Valgrind. To avoid this when running Valgrind, rebuild SQLite without this flag. --- Makefile | 5 +++++ deps/Makefile | 2 ++ 2 files changed, 7 insertions(+) diff --git a/Makefile b/Makefile index 61baa3820..4678a1e20 100644 --- a/Makefile +++ b/Makefile @@ -55,6 +55,11 @@ export SOURCE_DATE_EPOCH ### ``` ### ### ** to use on-demand coredump generation feature, compile code without ASAN option (WITHASAN=0). +### +### NOTES for Valgrind: +### When running Valgrind, SQLite's internal memory allocator may cause false +### positives in pcache*, memjrnl*, and sqlite3Btree* functions. To avoid this, +### rebuild SQLite with -USQLITE_ENABLE_MEMORY_MANAGEMENT in deps/Makefile O0 := -O0 O2 := -O2 diff --git a/deps/Makefile b/deps/Makefile index 6ab1ac267..c7a9783f3 100644 --- a/deps/Makefile +++ b/deps/Makefile @@ -267,6 +267,8 @@ endif mariadb_client: mariadb-client-library/mariadb_client/libmariadb/libmariadbclient.a +# NOTE: When running Valgrind on ProxySQL, remove -DSQLITE_ENABLE_MEMORY_MANAGEMENT +# to avoid false positives in SQLite's internal memory allocator (pcache*, memjrnl*, etc.) sqlite3/sqlite3/sqlite3.o: cd sqlite3 && rm -rf sqlite-amalgamation-*/ || true cd sqlite3 && tar -zxf sqlite-amalgamation-*.tar.gz