pub struct MemoryPressureProbe {
pub high_watermark: f64,
pub low_watermark: f64,
}Expand description
Lightweight memory pressure monitor.
Call is_high() before eviction decisions to determine whether to be
aggressive. If the platform is unsupported, is_high() always returns
false, meaning the pager relies entirely on the byte-budget to drive
eviction.
§Defaults
high_watermark = 0.90— trigger aggressive eviction above 90% RSS.low_watermark = 0.75— stop evicting once below 75% RSS.
Fields§
§high_watermark: f64RSS / total-RAM fraction above which pressure is considered high.
low_watermark: f64RSS / total-RAM fraction below which pressure is considered low (used by callers implementing hysteresis).
Implementations§
Source§impl MemoryPressureProbe
impl MemoryPressureProbe
Sourcepub fn new(high_watermark: f64, low_watermark: f64) -> Self
pub fn new(high_watermark: f64, low_watermark: f64) -> Self
Create a new probe with the given watermarks.
§Panics (debug)
Panics in debug builds if low_watermark >= high_watermark.
Trait Implementations§
Source§impl Clone for MemoryPressureProbe
impl Clone for MemoryPressureProbe
Source§fn clone(&self) -> MemoryPressureProbe
fn clone(&self) -> MemoryPressureProbe
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for MemoryPressureProbe
impl Debug for MemoryPressureProbe
Auto Trait Implementations§
impl Freeze for MemoryPressureProbe
impl RefUnwindSafe for MemoryPressureProbe
impl Send for MemoryPressureProbe
impl Sync for MemoryPressureProbe
impl Unpin for MemoryPressureProbe
impl UnsafeUnpin for MemoryPressureProbe
impl UnwindSafe for MemoryPressureProbe
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more