diff --git a/configure b/configure
index b52abded9c86fd6f5620720cbea7f205b4dd9854..3ac0c9167686132bb5f54982832c182a9339cf33 100755
--- a/configure
+++ b/configure
@@ -18721,8 +18721,6 @@ else
   LKT_SANITIZER=no
 fi
 
-# address => -fsanitizer=address,leak
-# thread  => -fsanitizer=thread
 if test "x$LKT_SANITIZER" == "xyes" ; then
     { $as_echo "$as_me:${as_lineno-$LINENO}: Build with sanitizers enabled" >&5
 $as_echo "$as_me: Build with sanitizers enabled" >&6;}
@@ -18900,6 +18898,62 @@ if test $? -ne 0 ; then
     as_fn_error $? "Faield to get sqlite3 with pkg-config, is dev lib for sqlite3 installed?" "$LINENO" 5
 fi
 
+#############################
+# Search for some functions #
+#############################
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for sqlite3_hard_heap_limit64 in -lsqlite3" >&5
+$as_echo_n "checking for sqlite3_hard_heap_limit64 in -lsqlite3... " >&6; }
+if ${ac_cv_lib_sqlite3_sqlite3_hard_heap_limit64+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lsqlite3  $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char sqlite3_hard_heap_limit64 ();
+int
+main ()
+{
+return sqlite3_hard_heap_limit64 ();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_lib_sqlite3_sqlite3_hard_heap_limit64=yes
+else
+  ac_cv_lib_sqlite3_sqlite3_hard_heap_limit64=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_sqlite3_sqlite3_hard_heap_limit64" >&5
+$as_echo "$ac_cv_lib_sqlite3_sqlite3_hard_heap_limit64" >&6; }
+if test "x$ac_cv_lib_sqlite3_sqlite3_hard_heap_limit64" = xyes; then :
+
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: Lib sqlite3 contains sqlite3_hard_heap_limit64" >&5
+$as_echo "Lib sqlite3 contains sqlite3_hard_heap_limit64" >&6; }
+
+else
+
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unable to find the sqlite3_hard_heap_limit64() function" >&5
+$as_echo "$as_me: WARNING: unable to find the sqlite3_hard_heap_limit64() function" >&2;}
+
+$as_echo "#define LKT_NO_SQLITE3_HARD_HEAP_LIMIT64_FUNCTION /**/" >>confdefs.h
+
+
+fi
+
+
 ################
 # CONF RESULTS #
 ################
diff --git a/configure.ac b/configure.ac
index 638134b4058ae6068f5864ef9fdf093d547288a5..ce79a2eca918208098ed29395a97024856370bf1 100644
--- a/configure.ac
+++ b/configure.ac
@@ -295,8 +295,6 @@ AC_ARG_WITH([sanitizer],
                             [Build with sanitizer enabled, yes by default.])],
             [LKT_SANITIZER=$withval],
             [LKT_SANITIZER=no])
-# address => -fsanitizer=address,leak
-# thread  => -fsanitizer=thread
 if test "x$LKT_SANITIZER" == "xyes" ; then
     AC_MSG_NOTICE([Build with sanitizers enabled])
     SANITIZERS="undefined,shift-exponent,shift-base,vla-bound,nullsigned-integer-overflow,bounds-strict,float-cast-overflow,bool,enum,address"
@@ -432,6 +430,17 @@ if test $? -ne 0 ; then
     AC_MSG_ERROR([Faield to get sqlite3 with pkg-config, is dev lib for sqlite3 installed?])
 fi
 
+#############################
+# Search for some functions #
+#############################
+
+AC_CHECK_LIB([sqlite3], [sqlite3_hard_heap_limit64], [
+    AC_MSG_RESULT(Lib sqlite3 contains sqlite3_hard_heap_limit64)
+], [
+    AC_MSG_WARN([unable to find the sqlite3_hard_heap_limit64() function])
+    AC_DEFINE([LKT_NO_SQLITE3_HARD_HEAP_LIMIT64_FUNCTION], [], [No hard heap limit for sqlite3])
+])
+
 ################
 # CONF RESULTS #
 ################
diff --git a/inc/lektor/lktconfig.h.in b/inc/lektor/lktconfig.h.in
index 0dc82c4b582056d38b980af27842d4d274b4b618..1fc8f420b9212a29c45220f80ffc8d4484c6e9b7 100644
--- a/inc/lektor/lktconfig.h.in
+++ b/inc/lektor/lktconfig.h.in
@@ -96,6 +96,9 @@
 /* Path to the man executable */
 #undef LKT_MAN_BINARY
 
+/* No hard heap limit for sqlite3 */
+#undef LKT_NO_SQLITE3_HARD_HEAP_LIMIT64_FUNCTION
+
 /* Prefix Path for Lektor */
 #undef LKT_PREFIX_PATH
 
diff --git a/src/database/open.c b/src/database/open.c
index 3a0bde4216b7efb260c58e0ed2ae102cf6894aee..705dd1a956615d5736ce47ded589d9f9394b9f54 100644
--- a/src/database/open.c
+++ b/src/database/open.c
@@ -16,6 +16,15 @@ static const char *__pragmas = "PRAGMA case_sensitive_like = false;\n"
 #define HEAP_LIMIT_SOFT 100 * 1024 * 1024
 #define HEAP_LIMIT_HARD 150 * 1024 * 1024
 
+#if defined(LKT_NO_SQLITE3_HARD_HEAP_LIMIT64_FUNCTION)
+sqlite3_int64
+sqlite3_hard_heap_limit64(sqlite3_int64 UNUSED limit)
+{
+    LOG_ERROR("DB", "No sqlite3_hard_heap_limit64 function on your system");
+    return 0;
+}
+#endif
+
 struct named_db {
     volatile sqlite3 *db;
     const char *name;