]> git.kaiwu.me - haproxy.git/commit
MINOR: implement ha_aligned_alloc() to return aligned memory areas
authorWilly Tarreau <w@1wt.eu>
Thu, 31 Jul 2025 13:26:58 +0000 (15:26 +0200)
committerWilly Tarreau <w@1wt.eu>
Wed, 6 Aug 2025 17:19:27 +0000 (19:19 +0200)
commit325d1bdcca5612808f70214f507e74b23d34063b
tree2875308c7f3aa9c51a704a3153c7a89fb3aa5d53
parente921fe894f6b992414e595be9450a9092f4df48e
MINOR: implement ha_aligned_alloc() to return aligned memory areas

We have two versions, _safe() which verifies and adjusts alignment,
and the regular one which trusts the caller. There's also a dedicated
ha_aligned_free() due to mingw.

The currently detected OSes are mingw, unixes older than POSIX 200112
which require memalign(), and those post 200112 which will use
posix_memalign(). Solaris 10 reports 200112 (probably through
_GNU_SOURCE since it does not do it by default), and Solaris 11 still
supports memalign() so for all Solaris we use memalign(). The memstats
wrappers are also implemented, and have the exported names. This was
the opportunity for providing a separate free call that lets the caller
specify the size (e.g. for use with pools).

For now this code is not used.
include/haproxy/bug.h
include/haproxy/tools.h