Skip to main content

Module memory_profiler

Module memory_profiler 

Source
Expand description

Advanced memory profiling for TrustformeRS models.

This module provides comprehensive memory profiling capabilities including:

  • Heap allocation tracking
  • Memory leak detection
  • Peak memory analysis
  • Allocation patterns
  • GC pressure analysis
  • Memory fragmentation monitoring

§Example

use trustformers_debug::{MemoryProfiler, MemoryProfilingConfig};

let config = MemoryProfilingConfig::default();
let mut profiler = MemoryProfiler::new(config);

profiler.start().await?;
// ... run model training/inference ...
let report = profiler.stop().await?;

println!("Peak memory usage: {} MB", report.peak_memory_mb);
println!("Memory leaks detected: {}", report.potential_leaks.len());

Structs§

AllocationPattern
Allocation pattern detected by analysis
AllocationRecord
Allocation record for tracking individual allocations
AllocationTypeStats
Statistics for each allocation type
FragmentationAnalysis
Memory fragmentation analysis
GCPressureAnalysis
Garbage collection pressure analysis
MemoryLeak
Memory leak information
MemoryProfiler
Memory profiler implementation
MemoryProfilingConfig
Configuration for memory profiling
MemoryProfilingReport
Comprehensive memory profiling report
MemorySnapshot
Memory usage snapshot at a point in time

Enums§

AllocationType
Type of allocation
FragmentationSeverity
Fragmentation severity levels
GCPressureLevel
GC pressure levels
LeakSeverity
Severity of memory leak
PatternType
Type of allocation pattern