pub struct MemoryTracker { /* private fields */ }Expand description
Memory usage tracker with pressure detection
Implementations§
Source§impl MemoryTracker
impl MemoryTracker
Sourcepub fn new(budget: MemoryBudget) -> Self
pub fn new(budget: MemoryBudget) -> Self
Create new memory tracker with given budget
Sourcepub fn deallocate(&self, bytes: u64)
pub fn deallocate(&self, bytes: u64)
Record memory deallocation
Sourcepub fn should_block_writes(&self) -> bool
pub fn should_block_writes(&self) -> bool
Check if writes should be blocked (hard limit exceeded)
Sourcepub fn should_trigger_flush(&self) -> bool
pub fn should_trigger_flush(&self) -> bool
Check if early flush should be triggered (soft limit exceeded)
Sourcepub fn current_usage(&self) -> u64
pub fn current_usage(&self) -> u64
Get current memory usage
Sourcepub fn usage_percent(&self) -> f64
pub fn usage_percent(&self) -> f64
Get memory usage as percentage of budget
Auto Trait Implementations§
impl Freeze for MemoryTracker
impl RefUnwindSafe for MemoryTracker
impl Send for MemoryTracker
impl Sync for MemoryTracker
impl Unpin for MemoryTracker
impl UnwindSafe for MemoryTracker
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> 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