pub struct AllocationInfo {Show 17 fields
pub ptr: usize,
pub size: usize,
pub timestamp_alloc: u128,
pub timestamp_dealloc: Option<u128>,
pub var_name: Option<String>,
pub type_name: Option<String>,
pub thread_id: String,
pub peak_size: Option<usize>,
pub growth_events: usize,
pub scope_name: Option<String>,
pub ownership_pattern: Option<OwnershipPattern>,
pub risk_level: Option<RiskLevel>,
pub efficiency_score: Option<f64>,
pub borrow_count: usize,
pub mut_borrow_count: usize,
pub transfer_count: usize,
pub metadata_tags: Vec<String>,
}
Expand description
Enhanced information about a memory allocation with lifecycle tracking
Fields§
§ptr: usize
Memory address of the allocation
size: usize
Size of the allocation in bytes
timestamp_alloc: u128
Timestamp when the allocation occurred (milliseconds since UNIX_EPOCH)
timestamp_dealloc: Option<u128>
Timestamp when the deallocation occurred (if applicable)
var_name: Option<String>
Optional name of the variable associated with this allocation
type_name: Option<String>
Optional type name of the variable associated with this allocation
thread_id: String
Thread ID where the allocation occurred
peak_size: Option<usize>
Peak memory size reached during lifetime (for growable types)
growth_events: usize
Number of memory growth events (reallocations)
scope_name: Option<String>
Scope identifier where this allocation occurred
ownership_pattern: Option<OwnershipPattern>
Ownership pattern for this allocation
risk_level: Option<RiskLevel>
Risk classification for this allocation
efficiency_score: Option<f64>
Memory efficiency score (useful_bytes / allocated_bytes)
borrow_count: usize
Borrowing events count (how many times this was borrowed)
mut_borrow_count: usize
Mutable borrowing events count
transfer_count: usize
Ownership transfer events
Custom metadata tags
Implementations§
Source§impl AllocationInfo
impl AllocationInfo
Sourcepub fn new(ptr: usize, size: usize) -> Self
pub fn new(ptr: usize, size: usize) -> Self
Create a new allocation info with enhanced lifecycle tracking
Sourcepub fn mark_deallocated(&mut self)
pub fn mark_deallocated(&mut self)
Mark this allocation as deallocated
Sourcepub fn lifetime_ms(&self) -> Option<u128>
pub fn lifetime_ms(&self) -> Option<u128>
Get the lifetime of this allocation in milliseconds
Sourcepub fn record_growth(&mut self, new_size: usize)
pub fn record_growth(&mut self, new_size: usize)
Record a memory growth event (reallocation)
Sourcepub fn record_borrow(&mut self, is_mutable: bool)
pub fn record_borrow(&mut self, is_mutable: bool)
Record a borrowing event
Sourcepub fn record_transfer(&mut self)
pub fn record_transfer(&mut self)
Record an ownership transfer
Sourcepub fn add_metadata_tag(&mut self, tag: String)
pub fn add_metadata_tag(&mut self, tag: String)
Add a metadata tag
Sourcepub fn memory_growth_factor(&self) -> f64
pub fn memory_growth_factor(&self) -> f64
Calculate memory growth factor
Sourcepub fn classify_risk(&mut self)
pub fn classify_risk(&mut self)
Classify the risk level of this allocation
Sourcepub fn determine_ownership_pattern(&mut self)
pub fn determine_ownership_pattern(&mut self)
Determine ownership pattern based on type
Trait Implementations§
Source§impl Clone for AllocationInfo
impl Clone for AllocationInfo
Source§fn clone(&self) -> AllocationInfo
fn clone(&self) -> AllocationInfo
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more