Skip to main content

Module memory_profiling

Module memory_profiling 

Source
Expand description

§Advanced Memory Profiling for SciRS2 v0.2.0

This module provides comprehensive memory profiling capabilities using jemalloc. It enables heap profiling, memory leak detection, and allocation pattern analysis.

§Features

  • Heap Profiling: Track memory allocations and deallocations
  • Leak Detection: Identify memory leaks
  • Allocation Patterns: Analyze allocation patterns
  • Statistics: Detailed memory statistics
  • Zero Overhead: Disabled by default, minimal overhead when enabled

§Example

use scirs2_core::profiling::memory_profiling::{MemoryProfiler, enable_profiling};

// Enable memory profiling
enable_profiling().expect("Failed to enable profiling");

// ... perform allocations ...

// Get memory statistics
let stats = MemoryProfiler::get_stats().expect("Failed to get stats");
println!("Allocated: {} bytes", stats.allocated);
println!("Resident: {} bytes", stats.resident);

Structs§

AllocationAnalysis
Allocation pattern analysis
AllocationTracker
Allocation tracker for detecting patterns
MemoryDelta
Memory delta from baseline
MemoryProfiler
Memory profiler
MemoryStats
Memory statistics from jemalloc

Functions§

disable_profiling
Disable memory profiling
enable_profiling
Enable memory profiling