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§fn clone(&self) -> MemoryStats
fn clone(&self) -> MemoryStats
Returns a duplicate of the value. Read more
1.0.0§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for MemoryStats
impl Debug for MemoryStats
Source§impl Default for MemoryStats
impl Default for MemoryStats
Source§fn default() -> MemoryStats
fn default() -> MemoryStats
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for MemoryStats
impl RefUnwindSafe for MemoryStats
impl Send for MemoryStats
impl Sync for MemoryStats
impl Unpin for MemoryStats
impl UnwindSafe for MemoryStats
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
🔬This is a nightly-only experimental API. (
clone_to_uninit)