From a11c3b83e3a3689700b12551650d8f5a681db5fb Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Tue, 8 Mar 2022 15:10:05 +0100 Subject: [PATCH] BUILD: pools: fix backport of no-memory-trimming on non-linux OS Commit 4bcff9ba4 in 2.5 ("MINOR: pools: add a new global option "no-memory-trimming"") was missing some extra ifdefs for the cases where the allocator doesn't have malloc_trim() and fails to build on windows. This must be backported to 2.4. --- src/pool.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/pool.c b/src/pool.c index d34e6d5..e9778e5 100644 --- a/src/pool.c +++ b/src/pool.c @@ -728,6 +728,7 @@ static int mem_parse_global_fail_alloc(char **args, int section_type, struct pro } #endif +#if defined(HA_HAVE_MALLOC_TRIM) /* config parser for global "no-memory-trimming" */ static int mem_parse_global_no_mem_trim(char **args, int section_type, struct proxy *curpx, const struct proxy *defpx, const char *file, int line, @@ -738,13 +739,16 @@ static int mem_parse_global_no_mem_trim(char **args, int section_type, struct pr disable_trim = 1; return 0; } +#endif /* register global config keywords */ static struct cfg_kw_list mem_cfg_kws = {ILH, { #ifdef DEBUG_FAIL_ALLOC { CFG_GLOBAL, "tune.fail-alloc", mem_parse_global_fail_alloc }, #endif +#if defined(HA_HAVE_MALLOC_TRIM) { CFG_GLOBAL, "no-memory-trimming", mem_parse_global_no_mem_trim }, +#endif { 0, NULL, NULL } }}; -- 1.7.10.4