MINOR: pools: report it when malloc_trim() is enabled
Since we can detect it at runtime now, it could help to have it mentioned
in haproxy -vv.
diff --git a/src/pool.c b/src/pool.c
index f1c165d..94bbb83 100644
--- a/src/pool.c
+++ b/src/pool.c
@@ -68,6 +68,11 @@
using_libc_allocator = !!memcmp(&mi1, &mi2, sizeof(mi1));
}
+
+static int is_trim_enabled(void)
+{
+ return using_libc_allocator;
+}
#else
static void trim_all_pools(void)
@@ -76,6 +81,11 @@
static void detect_allocator(void)
{
+}
+
+static int is_trim_enabled(void)
+{
+ return 0;
}
#endif
@@ -540,6 +550,17 @@
INITCALL0(STG_PREPARE, init_pools);
+/* Report in build options if trim is supported */
+static void pools_register_build_options(void)
+{
+ if (is_trim_enabled()) {
+ char *ptr = NULL;
+ memprintf(&ptr, "Support for malloc_trim() is enabled.");
+ hap_register_build_opts(ptr, 1);
+ }
+}
+INITCALL0(STG_REGISTER, pools_register_build_options);
+
/* register cli keywords */
static struct cli_kw_list cli_kws = {{ },{
{ { "show", "pools", NULL }, "show pools : report information about the memory pools usage", NULL, cli_io_handler_dump_pools },