pub struct MemoryTracker { /* private fields */ }Expand description
Memory tracker for monitoring heap allocations and providing adaptive behavior
Implementations§
Source§impl MemoryTracker
impl MemoryTracker
Sourcepub fn with_thresholds(moderate: u64, high: u64, critical: u64) -> Self
pub fn with_thresholds(moderate: u64, high: u64, critical: u64) -> Self
Create a new memory tracker with custom thresholds (in MB)
Sourcepub fn record_allocation(&self, size: usize)
pub fn record_allocation(&self, size: usize)
Record a memory allocation
Sourcepub fn record_deallocation(&self, size: usize)
pub fn record_deallocation(&self, size: usize)
Record a memory deallocation
Sourcepub fn get_usage(&self) -> MemoryUsage
pub fn get_usage(&self) -> MemoryUsage
Get current memory usage statistics
Sourcepub fn current_memory(&self) -> u64
pub fn current_memory(&self) -> u64
Get current memory usage in bytes
Sourcepub fn memory_pressure(&self) -> MemoryPressure
pub fn memory_pressure(&self) -> MemoryPressure
Get current memory pressure level
Sourcepub fn check_memory_pressure(&self) -> MemoryPressure
pub fn check_memory_pressure(&self) -> MemoryPressure
Check if memory pressure has changed and log if necessary
Sourcepub fn efficiency_metrics(&self) -> MemoryEfficiencyMetrics
pub fn efficiency_metrics(&self) -> MemoryEfficiencyMetrics
Get memory efficiency metrics
Trait Implementations§
Source§impl Debug for MemoryTracker
impl Debug for MemoryTracker
Auto Trait Implementations§
impl !Freeze for MemoryTracker
impl RefUnwindSafe for MemoryTracker
impl Send for MemoryTracker
impl Sync for MemoryTracker
impl Unpin for MemoryTracker
impl UnsafeUnpin 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