From 6ef28d0a7097fdeb5b64275a8ca37657008d0d72 Mon Sep 17 00:00:00 2001 From: Eric Leblond Date: Thu, 11 Feb 2021 11:01:18 +0100 Subject: [PATCH] util/thash: fix memcap consolidate function The function THashConsolidateMemcap is used to allow to load a dataset even when the memcap is not set. But the implementation was in fact resetting the memcap value to the max of memory usaga after loading and default memcap. As a result, the function was resetting memcap to the default memcap even if a huge memcap was set in the dataset definition. In the case of dataset where we add to the set it was leading to memcap limit hitting despite the settings of memcap by the user. This patch udpates the code to set the final memcap value to the max of memory usage after loading and set memcap. --- src/util-thash.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/util-thash.c b/src/util-thash.c index a90558066b..93cf882f0b 100644 --- a/src/util-thash.c +++ b/src/util-thash.c @@ -336,7 +336,7 @@ THashTableContext *THashInit(const char *cnf_prefix, size_t data_size, * */ void THashConsolidateMemcap(THashTableContext *ctx) { - ctx->config.memcap = MAX(SC_ATOMIC_GET(ctx->memuse), THASH_DEFAULT_MEMCAP); + ctx->config.memcap = MAX(SC_ATOMIC_GET(ctx->memuse), ctx->config.memcap); SCLogDebug("memcap after load set to: %" PRIu64, ctx->config.memcap); } -- 2.47.2