mirror of
https://github.com/home-assistant/supervisor.git
synced 2026-08-13 08:22:36 +01:00
Switch the Supervisor container from preloading jemalloc process-wide to selecting mimalloc as CPython's object allocator via PYTHONMALLOC, matching the same change in Home Assistant Core (home-assistant/core#175604). mimalloc is bundled in CPython 3.13+, so no LD_PRELOAD and no external allocator library are needed. Benchmarks on the Core image (same Python 3.14/musl base) showed jemalloc has no measurable CPU advantage over the default allocator while retaining substantially more memory, and PYTHONMALLOC=mimalloc gave the best combined result (~27% lower peak RSS than jemalloc at CPU parity). jemalloc also bakes the page size in at build time and aborts on aarch64 kernels with 16K/64K pages, whereas mimalloc queries the page size at runtime. PYTHONMALLOC is only defaulted, not forced, so users can still override the allocator, e.g. PYTHONMALLOC=pymalloc for CPython's default. Co-authored-by: Claude Fable 5 <noreply@anthropic.com>