Skip to main content

AllocationInfo

Struct AllocationInfo 

Source
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: usize

Memory address of the allocation.

§size: usize

Size 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: u64

Timestamp when the allocation was made.

§timestamp_dealloc: Option<u64>

Optional timestamp when the allocation was deallocated.

§thread_id: ThreadId

Thread ID where the allocation occurred.

§thread_id_u64: u64

Thread ID as u64 (original value from tracking).

§borrow_count: usize

Number of active borrows for this allocation.

§stack_trace: Option<Vec<String>>

Optional stack trace at the time of allocation.

§is_leaked: bool

Whether 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: bool

Flag 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

Source

pub fn new(ptr: usize, size: usize) -> Self

Create a new AllocationInfo instance with improved field enhancements.

§Arguments
  • ptr - Memory address of the allocation
  • size - 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());
Source

pub fn set_source_location(&mut self, file: &str, line: u32)

Set source location (file and line) for this allocation.

Source

pub fn set_smart_pointer_info(&mut self, info: SmartPointerInfo)

Set smart pointer information for this allocation.

Source

pub fn mark_deallocated(&mut self)

Mark this allocation as deallocated with current timestamp.

Source

pub fn is_active(&self) -> bool

Check if this allocation is still active (not deallocated).

Source

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

Source§

fn clone(&self) -> AllocationInfo

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for AllocationInfo

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for AllocationInfo

Source§

fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl From<AllocationInfo> for AllocationInfo

Source§

fn from(old: AllocationInfo) -> Self

Converts to this type from the input type.
Source§

impl From<AllocationInfo> for AllocationInfo

Source§

fn from(info: AllocationInfo) -> Self

Converts to this type from the input type.
Source§

impl PartialEq for AllocationInfo

Source§

fn eq(&self, other: &AllocationInfo) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for AllocationInfo

Source§

fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for AllocationInfo

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,