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_tsetting.
Functions§
- all
- Every option this build knows about, in C declaration order, as
(name, value)pairs — including the ones without anOptconstant. - 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 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.