Skip to main content

Module options

Module options 

Source
Expand description

mimalloc’s mi_option_* settings: the runtime knobs behind every MIMALLOC_* environment variable.

Options are read once, lazily, the first time the allocator needs them, so setting one after the allocation it governs has already happened has no effect. In particular [Opt::SCAVENGER] and the profiler options must be set before the first allocation to matter; [Opt::PURGE_HOLES] and its companions are re-read per sweep and can be changed at any time.

use mimalloc_pprof::options::{self, Opt};
let previous = options::get(Opt::PURGE_HOLES_MIN_INTERVAL);
options::set(Opt::PURGE_HOLES_MIN_INTERVAL, 0); // sweep on every idle call
mimalloc_pprof::on_thread_idle();
options::set(Opt::PURGE_HOLES_MIN_INTERVAL, previous);

Structs§

Opt
One mi_option_t setting.

Functions§

all
Every option this build knows about, in C declaration order, as (name, value) pairs — including the ones without an Opt constant.
disable
Turn a boolean option off.
enable
Turn a boolean option on.
get
Read an option’s value.
get_clamp
Read an option’s value, clamped into min..=max.
get_size
Read an option’s value as a size_t, for options that count bytes.
is_enabled
Whether a boolean option is on.
print
Print every option’s current value to mimalloc’s output sink.
set
Set an option’s value, overriding both the default and the environment.
set_default
Set an option’s value only if the environment did not already set it.
set_enabled
Turn a boolean option on or off.
set_enabled_default
Set a boolean option’s default, which the environment still overrides.