summaryrefslogtreecommitdiffstats
path: root/server.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicholas.marriott@gmail.com>2021-03-11 08:39:41 +0000
committerNicholas Marriott <nicholas.marriott@gmail.com>2021-03-11 08:39:41 +0000
commitef9700816fd2bd521bab837ccd85e0a596aa3aa8 (patch)
treede386512df432a5f47010bca6b0f1720fe4b103b /server.c
parent12cfd0d22b630ead9c6d739b13c3409485ea551c (diff)
malloc_trim is itself very poor and gets slower and slower as the heap becomes
more fragmented. Run it only once an hour. GitHub issue 2551.
Diffstat (limited to 'server.c')
-rw-r--r--server.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/server.c b/server.c
index ab8c6574..0b878d9e 100644
--- a/server.c
+++ b/server.c
@@ -159,6 +159,10 @@ server_tidy_event(__unused int fd, __unused short events, __unused void *data)
format_tidy_jobs();
+#ifdef HAVE_MALLOC_TRIM
+ malloc_trim(0);
+#endif
+
log_debug("%s: took %llu milliseconds", __func__, get_timer() - t);
evtimer_add(&server_ev_tidy, &tv);
}