pub struct MemoryProfiler { /* private fields */ }Expand description
Memory profiler for tracking allocations and usage.
Implementations§
Source§impl MemoryProfiler
impl MemoryProfiler
Sourcepub fn record_alloc(&mut self, name: &str, bytes: usize)
pub fn record_alloc(&mut self, name: &str, bytes: usize)
Records a memory allocation.
Sourcepub fn record_free(&mut self, name: &str, bytes: usize)
pub fn record_free(&mut self, name: &str, bytes: usize)
Records a memory deallocation.
Sourcepub fn current_usage(&self) -> usize
pub fn current_usage(&self) -> usize
Returns current memory usage in bytes.
Sourcepub fn peak_usage(&self) -> usize
pub fn peak_usage(&self) -> usize
Returns peak memory usage in bytes.
Sourcepub fn total_allocated(&self) -> usize
pub fn total_allocated(&self) -> usize
Returns total bytes allocated.
Sourcepub fn total_freed(&self) -> usize
pub fn total_freed(&self) -> usize
Returns total bytes freed.
Sourcepub fn stats(&self) -> MemoryStats
pub fn stats(&self) -> MemoryStats
Returns memory statistics.
Sourcepub fn leaks(&self) -> Vec<AllocationRecord>
pub fn leaks(&self) -> Vec<AllocationRecord>
Returns memory leaks (allocations not freed).
Sourcepub fn format_bytes(bytes: usize) -> String
pub fn format_bytes(bytes: usize) -> String
Formats bytes into human-readable string.
Trait Implementations§
Source§impl Debug for MemoryProfiler
impl Debug for MemoryProfiler
Auto Trait Implementations§
impl Freeze for MemoryProfiler
impl RefUnwindSafe for MemoryProfiler
impl Send for MemoryProfiler
impl Sync for MemoryProfiler
impl Unpin for MemoryProfiler
impl UnwindSafe for MemoryProfiler
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