pub struct Config {
pub purge: Purge,
pub reserve: Option<Reserve>,
pub allow_large_os_pages: Option<bool>,
pub transparent_huge_pages: Option<bool>,
pub arena_eager_commit: Option<bool>,
pub arena_reserve: Option<usize>,
pub arena_max_object_size: Option<usize>,
}Expand description
Configuration applied by MiMalloc on its first allocation.
Every field can keep mimalloc’s current setting, including any value set through the environment.
Fields§
§purge: PurgeWhen freed memory is purged back to the operating system.
reserve: Option<Reserve>Memory reserved before the first allocation.
allow_large_os_pages: Option<bool>Whether mimalloc may back arenas with large (2 MiB) OS pages when the
kernel grants them. None keeps the current setting. Large-page
arenas are never purged, are not swappable, and come from the kernel’s
huge page pool.
transparent_huge_pages: Option<bool>Whether the process may use transparent huge pages. None keeps the
current setting, which allows them unless the environment disabled
them. On Linux this also sets the process flag the kernel consults for
every mapping. If MIMALLOC_ALLOW_THP=0 was set at load, Some(true)
restores that flag, but mimalloc still does not advise huge pages for
its own mappings.
arena_eager_commit: Option<bool>Whether the arenas mimalloc reserves on its own are committed eagerly
rather than on first use. None keeps mimalloc’s default (eager on
systems that overcommit or when large OS pages are allowed).
arena_reserve: Option<usize>Base size of the arenas mimalloc reserves on demand once existing
arenas are full, rounded up to KiB. mimalloc reserves at least two
chunks per arena and grows the size with the arena count and for
larger requests. None keeps mimalloc’s default (1 GiB).
Some(0) disables on-demand arenas. Pages that no existing arena can
hold are then mapped from the operating system and unmapped on
release.
arena_max_object_size: Option<usize>Largest page carved from an arena, in bytes, rounded up to a slice and
clamped between one slice and ARENA_MAX_OBJECT_SIZE. Larger pages
are mapped from the operating system and unmapped on release, so a
lower limit keeps occasional huge buffers from holding arena memory.
None keeps mimalloc’s setting under the same cap. See the module
docs on large objects.