Skip to main content

Purge

Enum Purge 

Source
pub enum Purge {
    Default,
    Never,
    After(Duration),
}
Expand description

When memory freed back to an arena is purged (decommitted) to the operating system.

The policy covers arena memory only. Pages above Config::arena_max_object_size and objects aligned beyond a slice are mapped directly and unmapped on release. Pinned reservations (see Reserve) are never purged.

When the kernel supports transparent huge pages and they are allowed (the default), a purge releases only whole 2 MiB granules freed since the arena’s last purge. A smaller freed range stays resident until its neighbors are freed too. The environment can select a finer granule with MIMALLOC_ALLOW_THP=1 or MIMALLOC_MINIMAL_PURGE_SIZE.

Variants§

§

Default

mimalloc’s default: its purge delay times its arena multiplier (four seconds in mimalloc 3.5).

§

Never

Never purge arena memory.

§

After(Duration)

Purge freed memory after a delay. The first free into an arena after a purge sets a deadline this far ahead, and the arena is purged at the first collection after it. A thread collects every 10,000 allocations that miss its fast path by default, so a process that allocates rarely can keep freed memory well past the deadline. Delays above MAX_PURGE_DELAY are clamped, and one below a millisecond purges each page as it is freed.

Trait Implementations§

Source§

impl Clone for Purge

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 Purge

Source§

impl Debug for Purge

Source§

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

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

impl Eq for Purge

Source§

impl PartialEq for Purge

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 Purge

Auto Trait Implementations§

§

impl Freeze for Purge

§

impl RefUnwindSafe for Purge

§

impl Send for Purge

§

impl Sync for Purge

§

impl Unpin for Purge

§

impl UnsafeUnpin for Purge

§

impl UnwindSafe for Purge

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.