]> git.ipfire.org Git - thirdparty/haproxy.git/commit
MEDIUM: pools: move the compat code from trim_all_pools() to malloc_trim()
authorWilly Tarreau <w@1wt.eu>
Wed, 22 Mar 2023 14:32:58 +0000 (15:32 +0100)
committerWilly Tarreau <w@1wt.eu>
Wed, 22 Mar 2023 16:30:28 +0000 (17:30 +0100)
commit4138f15182c548ecc8fa0bcb4039985b608e581e
tree7627290cf8b84a12cef7603464bf9a091e6f9f60
parenteaba76b02dd41e0a1a2e85a3e71f91dfc529916d
MEDIUM: pools: move the compat code from trim_all_pools() to malloc_trim()

We already have some generic code in trim_all_pools() to implement the
equivalent of malloc_trim() on jemalloc and macos. Instead of keeping the
logic there, let's just move it to our own malloc_trim() implementation
so that we can unify the mechanism and the logic. Now any low-level code
calling malloc_trim() will either be disabled by haproxy's config if the
user decides to, or will be mapped to the equivalent mechanism if malloc()
was intercepted by a preloaded jemalloc.

Trim_all_pools() preserves the benefit of serializing threads (which we
must not impose to other libs which could come with their own threads).
It means that our own code should mostly use trim_all_pools() instead of
calling malloc_trim() directly.
src/pool.c