Skip to main content

Config

Struct Config 

Source
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: Purge

When 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.

Implementations§

Source§

impl Config

Source

pub const DEFAULT: Self

Leaves every mimalloc option at its default, capping only the arena object-size limit at ARENA_MAX_OBJECT_SIZE.

Trait Implementations§

Source§

impl Clone for Config

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for Config

Source§

impl Debug for Config

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Config

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Eq for Config

Source§

impl PartialEq for Config

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Config

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.