pub struct AllocationInfo {Show 31 fields
pub ptr: usize,
pub size: usize,
pub var_name: Option<String>,
pub type_name: Option<String>,
pub scope_name: Option<String>,
pub timestamp_alloc: u64,
pub timestamp_dealloc: Option<u64>,
pub thread_id: ThreadId,
pub thread_id_u64: u64,
pub borrow_count: usize,
pub stack_trace: Option<Vec<String>>,
pub is_leaked: bool,
pub lifetime_ms: Option<u64>,
pub borrow_info: Option<BorrowInfo>,
pub clone_info: Option<CloneInfo>,
pub ownership_history_available: bool,
pub smart_pointer_info: Option<SmartPointerInfo>,
pub memory_layout: Option<MemoryLayoutInfo>,
pub generic_info: Option<GenericTypeInfo>,
pub dynamic_type_info: Option<DynamicTypeInfo>,
pub runtime_state: Option<RuntimeStateInfo>,
pub stack_allocation: Option<StackAllocationInfo>,
pub temporary_object: Option<TemporaryObjectInfo>,
pub fragmentation_analysis: Option<EnhancedFragmentationAnalysis>,
pub generic_instantiation: Option<GenericInstantiationInfo>,
pub type_relationships: Option<TypeRelationshipInfo>,
pub type_usage: Option<TypeUsageInfo>,
pub function_call_tracking: Option<FunctionCallTrackingInfo>,
pub lifecycle_tracking: Option<ObjectLifecycleInfo>,
pub access_tracking: Option<MemoryAccessTrackingInfo>,
pub drop_chain_analysis: Option<DropChainAnalysis>,
}Expand description
Information about a memory allocation.
Comprehensive tracking information for a single memory allocation, including size, type, scope, lifecycle, and various analysis metadata.
Fields§
§ptr: usizeMemory address of the allocation.
size: usizeSize of the allocation in bytes.
var_name: Option<String>Optional variable name associated with this allocation.
type_name: Option<String>Optional type name of the allocated data.
scope_name: Option<String>Optional scope name where the allocation occurred.
timestamp_alloc: u64Timestamp when the allocation was made.
timestamp_dealloc: Option<u64>Optional timestamp when the allocation was deallocated.
thread_id: ThreadIdThread ID where the allocation occurred.
thread_id_u64: u64Thread ID as u64 (original value from tracking).
borrow_count: usizeNumber of active borrows for this allocation.
stack_trace: Option<Vec<String>>Optional stack trace at the time of allocation.
is_leaked: boolWhether this allocation is considered leaked.
lifetime_ms: Option<u64>Precise lifetime in milliseconds (calculated from creation to destruction).
borrow_info: Option<BorrowInfo>Enhanced borrowing information.
clone_info: Option<CloneInfo>Enhanced cloning information.
ownership_history_available: boolFlag indicating if detailed ownership history is available in lifetime.json.
smart_pointer_info: Option<SmartPointerInfo>Smart pointer specific information.
memory_layout: Option<MemoryLayoutInfo>Detailed memory layout information.
generic_info: Option<GenericTypeInfo>Generic type information.
dynamic_type_info: Option<DynamicTypeInfo>Dynamic type information (trait objects).
runtime_state: Option<RuntimeStateInfo>Runtime state information.
stack_allocation: Option<StackAllocationInfo>Stack allocation information (if allocated on stack).
temporary_object: Option<TemporaryObjectInfo>Temporary object information (if this is a temporary).
fragmentation_analysis: Option<EnhancedFragmentationAnalysis>Memory fragmentation analysis.
generic_instantiation: Option<GenericInstantiationInfo>Enhanced generic instantiation tracking.
type_relationships: Option<TypeRelationshipInfo>Type relationship information.
type_usage: Option<TypeUsageInfo>Type usage information.
function_call_tracking: Option<FunctionCallTrackingInfo>Function call tracking (if allocation is function-related).
lifecycle_tracking: Option<ObjectLifecycleInfo>Object lifecycle tracking.
access_tracking: Option<MemoryAccessTrackingInfo>Memory access pattern tracking.
drop_chain_analysis: Option<DropChainAnalysis>Drop chain analysis (when object is dropped).
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 AllocationInfo instance with improved field enhancements.
§Arguments
ptr- Memory address of the allocationsize- Size of the allocation in bytes
§Examples
use memscope_rs::capture::types::AllocationInfo;
let info = AllocationInfo::new(0x1000, 1024);
assert_eq!(info.ptr, 0x1000);
assert_eq!(info.size, 1024);
assert!(info.is_active());Sourcepub fn set_source_location(&mut self, file: &str, line: u32)
pub fn set_source_location(&mut self, file: &str, line: u32)
Set source location (file and line) for this allocation.
Sourcepub fn set_smart_pointer_info(&mut self, info: SmartPointerInfo)
pub fn set_smart_pointer_info(&mut self, info: SmartPointerInfo)
Set smart pointer information for this allocation.
Sourcepub fn mark_deallocated(&mut self)
pub fn mark_deallocated(&mut self)
Mark this allocation as deallocated with current timestamp.
Sourcepub fn enhance_with_type_info(&mut self, type_name: &str)
pub fn enhance_with_type_info(&mut self, type_name: &str)
Update allocation with type-specific enhancements.
Detects common patterns for Rc/Arc, Vec, String, HashMap, and Box types.
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 moreSource§impl Debug for AllocationInfo
impl Debug for AllocationInfo
Source§impl<'de> Deserialize<'de> for AllocationInfo
impl<'de> Deserialize<'de> for AllocationInfo
Source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
Source§impl From<AllocationInfo> for AllocationInfo
impl From<AllocationInfo> for AllocationInfo
Source§fn from(old: AllocationInfo) -> Self
fn from(old: AllocationInfo) -> Self
Source§impl From<AllocationInfo> for AllocationInfo
impl From<AllocationInfo> for AllocationInfo
Source§fn from(info: AllocationInfo) -> Self
fn from(info: AllocationInfo) -> Self
Source§impl PartialEq for AllocationInfo
impl PartialEq for AllocationInfo
Source§impl Serialize for AllocationInfo
impl Serialize for AllocationInfo
impl StructuralPartialEq for AllocationInfo
Auto Trait Implementations§
impl Freeze for AllocationInfo
impl RefUnwindSafe for AllocationInfo
impl Send for AllocationInfo
impl Sync for AllocationInfo
impl Unpin for AllocationInfo
impl UnsafeUnpin for AllocationInfo
impl UnwindSafe for AllocationInfo
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more