Use mimalloc as the Python allocator instead of preloading jemalloc (#175604)

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Stefan Agner
2026-07-13 20:24:47 +02:00
committed by GitHub
parent 3dd3d85ecd
commit 3b12041c7a
+9 -4
View File
@@ -5,9 +5,14 @@
cd /config || bashio::exit.nok "Can't find config folder!" cd /config || bashio::exit.nok "Can't find config folder!"
# Enable mimalloc for Home Assistant Core, unless disabled # Use mimalloc as Python's object allocator by default. It is bundled in CPython
if [[ -z "${DISABLE_JEMALLOC+x}" ]]; then # (3.13+), so no LD_PRELOAD or extra library is required, and it uses noticeably
export LD_PRELOAD="/usr/local/lib/libjemalloc.so.2" # less memory than the previously preloaded jemalloc. Override or disable via
export MALLOC_CONF="background_thread:true,metadata_thp:auto,dirty_decay_ms:20000,muzzy_decay_ms:20000" # PYTHONMALLOC, e.g. `PYTHONMALLOC=pymalloc` for the default allocator.
export PYTHONMALLOC="${PYTHONMALLOC:-mimalloc}"
if [[ -n "${DISABLE_JEMALLOC+x}" ]]; then
bashio::log.warning "DISABLE_JEMALLOC is set but no longer has any effect: jemalloc has been replaced by mimalloc. Set PYTHONMALLOC=pymalloc to use the default allocator instead."
fi fi
exec python3 -m homeassistant --config /config exec python3 -m homeassistant --config /config