pub struct MemoryStats {
pub allocations: u64,
pub deallocations: u64,
pub current_bytes: usize,
pub peak_bytes: usize,
pub total_bytes: usize,
}Expand description
Track memory usage for debugging and optimization.
Fields§
§allocations: u64Number of allocations.
deallocations: u64Number of deallocations.
current_bytes: usizeCurrent bytes allocated.
peak_bytes: usizePeak bytes allocated.
total_bytes: usizeTotal bytes allocated (lifetime).
Implementations§
Source§impl MemoryStats
impl MemoryStats
Sourcepub fn record_alloc(&mut self, bytes: usize)
pub fn record_alloc(&mut self, bytes: usize)
Record an allocation.
Sourcepub fn record_dealloc(&mut self, bytes: usize)
pub fn record_dealloc(&mut self, bytes: usize)
Record a deallocation.
Sourcepub fn net_allocations(&self) -> i64
pub fn net_allocations(&self) -> i64
Get the net allocation count.
Trait Implementations§
Source§impl Clone for MemoryStats
impl Clone for MemoryStats
Source§impl Debug for MemoryStats
impl Debug for MemoryStats
Auto Trait Implementations§
impl Forget for MemoryStats
impl Freeze for MemoryStats
impl Move for MemoryStats
impl RefUnwindSafe for MemoryStats
impl Send for MemoryStats
impl Sync for MemoryStats
impl Unpin for MemoryStats
impl UnsafeUnpin for MemoryStats
impl UnwindSafe for MemoryStats
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