From f9e56609401e505c835796726eff35e650810fff Mon Sep 17 00:00:00 2001 From: Stefan Boberg Date: Sun, 22 Mar 2026 10:57:12 +0100 Subject: Upgrade mimalloc to v2.2.7 and log active memory allocator (#876) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Upgrade mimalloc from v2.1.2 to v2.2.7. Note that mimalloc is no longer the default allocator so this only impacts users who somehow opt into mimalloc via `--malloc=mimalloc` or compile with different defaults - Add all available mimalloc versions (1.6.7–3.2.8) to the package definition for testing - Log the active memory allocator (with version where available) at server startup - Annotate vendored rpmalloc with its source commit and version ## Notable changes in mimalloc 2.1.2 → 2.2.7 - **Memory release fix** (2.2.4): fix case where OS memory was not always fully released - **Race condition fix** (2.2.6): fixed rare race condition and potential buffer overflow in debug statistics - **Windows arm64 support** (2.1.9) - **Guarded build** (2.1.9): new build mode that places OS guard pages behind objects to catch buffer overflows - **THP awareness** (2.2.6): auto-detects transparent huge pages and adjusts purge size to avoid fragmentation - **Faster TLS access on Windows** (2.2.6) - **Improved calloc and aligned allocation performance** (2.2.6) - **New diagnostic APIs** (2.2.2): `mi_options_print`, `mi_arenas_print`, `mi_stat_get` / `mi_stat_get_json` - **macOS**: use `MADV_FREE_REUSABLE` for better memory behavior (2.2.4) - **Build fixes**: Android, Xbox, musl, mingw, arm32, Debian 32-bit, non-BMI1 x64 systems ## Allocator logging Added `FMalloc::GetName()` pure virtual so the server logs which allocator is active at startup: ``` zenserver - memory allocator: mimalloc 2.2.7 ``` Allocator names include version where available: - `mimalloc 2.2.7` (runtime version via `mi_version()`) - `rpmalloc 1.5.0-dev.20250810` (ad-hoc version from vendored develop branch commit) - `ansi`, `stomp` (no version info available) ## Test plan - [x] Builds successfully on Windows (release) - [x] Verify server startup log shows allocator name - [x] Test with `--malloc=mimalloc` (default) and `--malloc=rpmalloc` - [x] Run test suites to check for regressions --- src/zencore/memory/mallocansi.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/zencore/memory/mallocansi.cpp') diff --git a/src/zencore/memory/mallocansi.cpp b/src/zencore/memory/mallocansi.cpp index 9c3936172..e9465b46b 100644 --- a/src/zencore/memory/mallocansi.cpp +++ b/src/zencore/memory/mallocansi.cpp @@ -248,4 +248,10 @@ FMallocAnsi::GetAllocationSize(void* Original, size_t& SizeOut) #endif } +const char* +FMallocAnsi::GetName() const +{ + return "ansi"; +} + } // namespace zen -- cgit v1.2.3