diff options
author | Frank Ch. Eigler <[email protected]> | 2024-03-18 16:06:02 -0400 |
---|---|---|
committer | Frank Ch. Eigler <[email protected]> | 2024-03-18 16:06:02 -0400 |
commit | a0ab32276adbc157ebdadd922fb7a45bd99c68c7 (patch) | |
tree | 885d6cd1a73a75c62f7f39ff0a6111015aedd677 /debuginfod | |
parent | d74f4c1d572fbeb7454a2ffa02cbc955ea24780d (diff) |
PR31103: debuginfod: periodically call malloc_trim(0)
Add malloc_trim() for releasing memory which is allocated for
temporary purposes, e.g. answering queries, adding data to the
database during scans. This patch just adds one call after the groom
cycle, but others could be added around webapi query handling or
scanning ops too.
Signed-off-by: Di Chen <[email protected]>
Diffstat (limited to 'debuginfod')
-rw-r--r-- | debuginfod/debuginfod.cxx | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/debuginfod/debuginfod.cxx b/debuginfod/debuginfod.cxx index 72617848..ece5031f 100644 --- a/debuginfod/debuginfod.cxx +++ b/debuginfod/debuginfod.cxx @@ -49,6 +49,11 @@ extern "C" { #include <execinfo.h> } #endif +#ifdef HAVE_MALLOC_H +extern "C" { +#include <malloc.h> +} +#endif #include "debuginfod.h" #include <dwarf.h> @@ -4226,9 +4231,11 @@ void groom() sqlite3_db_release_memory(db); // shrink the process if possible sqlite3_db_release_memory(dbq); // ... for both connections debuginfod_pool_groom(); // and release any debuginfod_client objects we've been holding onto - -#if 0 /* PR31265: don't jettison cache unnecessarily */ +#if HAVE_MALLOC_TRIM + malloc_trim(0); // PR31103: release memory allocated for temporary purposes +#endif +#if 0 /* PR31265: don't jettison cache unnecessarily */ fdcache.limit(0); // release the fdcache contents fdcache.limit(fdcache_mbs); // restore status quo parameters #endif |