From: Willy Tarreau Date: Wed, 22 Mar 2023 14:38:13 +0000 (+0100) Subject: MINOR: pattern: use trim_all_pools() instead of a conditional malloc_trim() X-Git-Tag: v2.8-dev6~19 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=9b060f148ea324de1e7e2686348e4c90d7c67394;p=thirdparty%2Fhaproxy.git MINOR: pattern: use trim_all_pools() instead of a conditional malloc_trim() First this will ensure that we serialize the threads and avoid severe contention. Second it removes ugly ifdefs and conditions. --- diff --git a/src/pattern.c b/src/pattern.c index 71f25a43b3..6c263bebec 100644 --- a/src/pattern.c +++ b/src/pattern.c @@ -2083,11 +2083,8 @@ int pat_ref_purge_range(struct pat_ref *ref, uint from, uint to, int budget) list_for_each_entry(expr, &ref->pat, list) HA_RWLOCK_WRUNLOCK(PATEXP_LOCK, &expr->lock); -#if defined(HA_HAVE_MALLOC_TRIM) - if (done && is_trim_enabled()) { - malloc_trim(0); - } -#endif + if (done) + trim_all_pools(); return done; }