Expand description
Memory tracking and visualization tools for Rust applications.
This crate provides tools for tracking memory allocations and visualizing memory usage in Rust applications. It includes a custom global allocator that tracks all heap allocations and deallocations, and provides utilities for exporting memory usage data in various formats.
Re-exports§
pub use crate::core::performance_optimizer::OptimizationRecommendations;pub use crate::core::performance_optimizer::PerformanceMetrics;pub use crate::core::performance_optimizer::PerformanceOptimizer;pub use crate::core::ultra_fast_tracker::SamplingStats;pub use crate::core::ultra_fast_tracker::UltraFastSamplingConfig;pub use crate::core::ultra_fast_tracker::UltraFastTracker;pub use export::export_user_variables_binary;pub use export::export_user_variables_json;pub use export::export_lifecycle_data;pub use export::LifecycleExportConfig;pub use export::LifecycleExporter;pub use export::binary::detect_binary_type;pub use export::binary::BinaryParser;pub use analysis::enhanced_memory_analysis::EnhancedMemoryAnalyzer;pub use analysis::unsafe_ffi_tracker::get_global_unsafe_ffi_tracker;pub use analysis::unsafe_ffi_tracker::UnsafeFFITracker;pub use core::allocator::TrackingAllocator;pub use core::tracker::memory_tracker::BinaryExportMode;pub use core::tracker::get_tracker;pub use core::tracker::ExportOptions;pub use core::tracker::MemoryTracker;pub use core::types::AllocationInfo;pub use core::types::TrackingError;pub use core::types::TrackingResult;pub use utils::format_bytes;pub use utils::get_simple_type;pub use utils::simplify_type_name;pub use advanced_types::*;pub use analysis::*;
Modules§
- advanced_
trackable_ macro - Macro for advanced type Trackable implementations Macro for implementing Trackable for advanced types
- advanced_
types - Advanced type analysis framework Advanced type analysis framework for complex Rust types
- analysis
- Advanced memory analysis functionality Memory analysis functionality
- async_
memory - Async Task-Centric Memory Tracking
- classification
- Type classification system
- cli
- Command-line interface functionality Command-line interface functionality
- core
- Core memory tracking functionality Core memory tracking functionality
- enhanced_
types - Enhanced types for comprehensive memory analysis Enhanced types for comprehensive memory analysis
- error
- Unified error handling and recovery system Unified error handling system for MemScope
- estimation
- Smart size estimation and type classification Intelligent size estimation module
- export
- Export and visualization functionality
- lockfree
- Lock-free multi-threaded memory tracking Lock-free multi-threaded memory tracking implementation
- memory
- Memory management and bounded history tracking Memory Management Module
- metrics
- Performance monitoring and metrics collection Performance monitoring and metrics collection system
- platform
- Platform-specific implementations for memory tracking Platform-specific implementations for memory tracking
- quality
- Code quality assurance and validation system Code quality assurance and validation system
- smart_
pointer_ utils - Smart pointer detection and analysis utilities.
- smart_
pointers - Smart pointer tracking and analysis Smart pointer tracking and analysis
- stack_
trace - Enhanced stack trace capture and analysis Enhanced stack trace capture and analysis
- test_
utils - Testing utilities and helpers
- tracking
- Memory allocation tracking statistics and monitoring Memory tracking module
- unified
- Unified backend for intelligent memory tracking
- utils
- Utility functions Common utility functions shared across modules
- variable_
registry - Variable registry for lightweight HashMap-based variable tracking Variable Registry - Simple HashMap-based variable name tracking
Macros§
- auto_
trace - Auto-tracking macro for scoped memory analysis
- convert_
error - Macro for easy error conversion in existing code
- enhanced_
system_ profile - Enhanced profiling macro for comprehensive system analysis
- handle_
edge_ case - Convenience macro for handling edge cases
- impl_
advanced_ trackable - Macro to implement Trackable for advanced types with automatic analysis
- init_
test - Macro for quick test initialization
- memscope_
bail - Macro for creating results with error context
- memscope_
error - Macro for creating errors with automatic context
- safe_
lock - Macro for safe lock acquisition
- set_
task_ tracking_ allocator - Set the global allocator to use task tracking
- track_
ffi_ alloc - Macro for tracking FFI allocations
- track_
scope - Macro for tracking scopes with automatic cleanup
- track_
unsafe_ alloc - Macro for tracking unsafe allocations
- track_
var - [RECOMMENDED] Track a variable’s memory allocation without taking ownership.
- track_
var_ owned - [ADVANCED] Track a variable with full lifecycle management and ownership transfer.
- track_
var_ smart - [SMART] Intelligent tracking that automatically chooses the best strategy.
- track_
var_ with_ scope - Enhanced track_var macro that also associates with current scope
- try_
unwrap_ safe - Convenience macro for trying to unwrap safely
- unwrap_
or_ default_ safe - Convenience macro for safe unwrapping with default value
- unwrap_
or_ else_ safe - Convenience macro for safe unwrapping with default function
- unwrap_
safe - Convenience macro for safe unwrapping with automatic context
- unwrap_
safe_ at - Convenience macro for safe unwrapping with location
Structs§
- Tracked
Variable - A wrapper that provides automatic lifecycle tracking for variables.
Traits§
- Trackable
- Trait for types that can be tracked by the memory tracker.
Functions§
- enable_
auto_ export - Enable automatic JSON export when program ends Call this at the beginning of your program to enable auto-export
- init
- Initialize the memory tracking system.
- init_
for_ testing - Initialize memscope-rs with optimized settings for testing This reduces logging and disables expensive features for faster test execution