You can set further options either programmatically (using mi_option_set
), or via environment variables.
MIMALLOC_SHOW_STATS=1
: show statistics when the program terminates.MIMALLOC_VERBOSE=1
: show verbose messages.MIMALLOC_SHOW_ERRORS=1
: show error and warning messages.MIMALLOC_PAGE_RESET=1
: reset (or purge) OS pages when not in use. This can reduce memory fragmentation in long running (server) programs. If performance is impacted, MIMALLOC_RESET_DELAY=
_msecs_ can be set higher (100ms by default) to make the page reset occur less frequently.MIMALLOC_LARGE_OS_PAGES=1
: use large OS pages when available; for some workloads this can significantly improve performance. Use MIMALLOC_VERBOSE
to check if the large OS pages are enabled – usually one needs to explicitly allow large OS pages (as on Windows and Linux). However, sometimes the OS is very slow to reserve contiguous physical memory for large OS pages so use with care on systems that can have fragmented memory (for that reason, we generally recommend to use MIMALLOC_RESERVE_HUGE_OS_PAGES
instead when possible).MIMALLOC_EAGER_REGION_COMMIT=1
: on Windows, commit large (256MiB) regions eagerly. On Windows, these regions show in the working set even though usually just a small part is committed to physical memory. This is why it turned off by default on Windows as it looks not good in the task manager. However, in reality it is always better to turn it on as it improves performance and has no other drawbacks.MIMALLOC_RESERVE_HUGE_OS_PAGES=N
: where N is the number of 1GiB huge OS pages. This reserves the huge pages at startup and can give quite a performance improvement on long running workloads. Usually it is better to not use MIMALLOC_LARGE_OS_PAGES
in combination with this setting. Just like large OS pages, use with care as reserving contiguous physical memory can take a long time when memory is fragmented. Note that we usually need to explicitly enable huge OS pages (as on Windows and Linux)). With huge OS pages, it may be beneficial to set the setting MIMALLOC_EAGER_COMMIT_DELAY=N
(with usually N
as 1) to delay the initial N
segments of a thread to not allocate in the huge OS pages; this prevents threads that are short lived and allocate just a little to take up space in the huge OS page area (which cannot be reset).