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 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_global_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
- 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
- export
- Export and visualization functionality
- smart_
pointer_ utils - Smart pointer detection and analysis utilities.
- test_
utils - Testing utilities and helpers
- 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§
- convert_
error - Macro for easy error conversion in existing code
- 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
- safe_
lock - Macro for safe lock acquisition
- 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.
Statics§
- GLOBAL
- Global tracking allocator instance used when the tracking-allocator feature is enabled.
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