From b61fccdc3f1ad23597ae1bf330855d115a60b6b5 Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Thu, 17 Feb 2022 17:15:02 +0100 Subject: [PATCH] CLEANUP: init: remove the ifdef on HAPROXY_MEMMAX It's ugly, let's move it to defaults.h with all other ones and preset it to zero if not defined. --- include/haproxy/defaults.h | 5 +++++ src/haproxy.c | 3 --- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/include/haproxy/defaults.h b/include/haproxy/defaults.h index 9b521dff1..8079d059d 100644 --- a/include/haproxy/defaults.h +++ b/include/haproxy/defaults.h @@ -385,6 +385,11 @@ #define MEM_USABLE_RATIO 0.97 #endif +/* if not 0, maximum allocatable memory per process in MB */ +#ifndef HAPROXY_MEMMAX +#define HAPROXY_MEMMAX 0 +#endif + /* Pools are always enabled unless explicitly disabled. When disabled, the * calls are directly passed to the underlying OS functions. */ diff --git a/src/haproxy.c b/src/haproxy.c index 4d95ae6eb..6350a6aa7 100644 --- a/src/haproxy.c +++ b/src/haproxy.c @@ -1513,10 +1513,7 @@ static void init(int argc, char **argv) totalconn = actconn = listeners = stopping = 0; killed = 0; - -#ifdef HAPROXY_MEMMAX global.rlimit_memmax_all = HAPROXY_MEMMAX; -#endif tzset(); clock_init_process_date();