aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/memory.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/memory.c')
-rw-r--r--src/memory.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/memory.c b/src/memory.c
index 605c221..26cde55 100644
--- a/src/memory.c
+++ b/src/memory.c
@@ -495,6 +495,16 @@ teco_memory_get_usage(void)
return procstk.ki_rssize * page_size;
}
+/**
+ * Options passed to jemalloc.
+ *
+ * It's crucial to disable opt.retain, so that freeing memory after
+ * recovering from memory limit hits actually decreases the RSS.
+ * The reasons for activating the option, mentioned in jemalloc(3),
+ * shouldn't be relevant on FreeBSD.
+ */
+const gchar *malloc_conf = "retain:false";
+
#define NEED_POLL_THREAD
#elif defined(G_OS_UNIX) && defined(HAVE_SYSCONF) && defined(HAVE_PROCFS)