pub struct MemoryManager { /* private fields */ }Expand description
Memory statistics and limits
Implementations§
Source§impl MemoryManager
impl MemoryManager
Sourcepub fn try_allocate(&self, bytes: usize, allocation_type: &str) -> bool
pub fn try_allocate(&self, bytes: usize, allocation_type: &str) -> bool
Try to allocate memory, returning false if it would exceed the limit
Sourcepub fn current_usage(&self) -> usize
pub fn current_usage(&self) -> usize
Get current memory usage
Sourcepub fn max_memory(&self) -> usize
pub fn max_memory(&self) -> usize
Get maximum memory limit
Sourcepub fn usage_percentage(&self) -> f64
pub fn usage_percentage(&self) -> f64
Get percentage of memory used
Sourcepub fn allocation_breakdown(&self) -> HashMap<String, usize>
pub fn allocation_breakdown(&self) -> HashMap<String, usize>
Get allocation breakdown
Sourcepub fn has_capacity(&self, bytes: usize) -> bool
pub fn has_capacity(&self, bytes: usize) -> bool
Check if we have enough memory for an allocation
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for MemoryManager
impl RefUnwindSafe for MemoryManager
impl Send for MemoryManager
impl Sync for MemoryManager
impl Unpin for MemoryManager
impl UnwindSafe for MemoryManager
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