pub struct MemoryEvent {Show 21 fields
pub timestamp: u64,
pub event_type: MemoryEventType,
pub ptr: usize,
pub size: usize,
pub old_size: Option<usize>,
pub new_ptr: Option<usize>,
pub binding_serial: Option<u64>,
pub degraded_release: bool,
pub charge_outcome: Option<ChargeOutcome>,
pub thread_id: u64,
pub var_name: Option<String>,
pub type_name: Option<String>,
pub call_stack_hash: Option<u64>,
pub thread_name: Option<String>,
pub source_file: Option<String>,
pub source_line: Option<u32>,
pub module_path: Option<String>,
pub clone_source_ptr: Option<usize>,
pub clone_target_ptr: Option<usize>,
pub stack_ptr: Option<usize>,
pub task_id: Option<u64>,
}Expand description
Unified memory event type
This structure captures all essential information about memory operations across all tracking backends (core, lockfree, async, unified).
Fields§
§timestamp: u64Event timestamp (nanoseconds since epoch)
event_type: MemoryEventTypeEvent type
ptr: usizeMemory pointer address
size: usizeAllocation size in bytes
old_size: Option<usize>Previous allocation size (for Reallocate events)
new_ptr: Option<usize>New address (for Reallocate events that moved the block).
None means the block stayed at ptr; Some(new_ptr) means it migrated,
so the old address binding must be closed and a new one opened.
binding_serial: Option<u64>Capture-local binding identity, preserved across reallocation. Older event streams omit it and use address/size matching during replay.
degraded_release: boolSet when a release could only be matched by address (the address held several live bindings), so the closed binding was chosen by policy rather than identified.
Carried by the event instead of only a counter: replay and every export can then say that this release is a lower bound of the evidence, not an exact fact.
charge_outcome: Option<ChargeOutcome>Registry charge result captured before publishing an allocation. Missing on legacy streams and non-allocation events; replay must not replace it with live registry state.
thread_id: u64Thread identifier
var_name: Option<String>Optional variable name
type_name: Option<String>Optional type name
call_stack_hash: Option<u64>Optional call stack hash
thread_name: Option<String>Optional thread name
source_file: Option<String>Optional source file path
source_line: Option<u32>Optional source line number
module_path: Option<String>Optional module path
clone_source_ptr: Option<usize>Clone source pointer (for Clone events)
clone_target_ptr: Option<usize>Clone target pointer (for Clone events)
stack_ptr: Option<usize>Stack pointer (for StackOwner types like Arc/Rc)
task_id: Option<u64>Task ID (for task-aware memory tracking)
Implementations§
Source§impl MemoryEvent
impl MemoryEvent
Sourcepub fn allocate(ptr: usize, size: usize, thread_id: u64) -> Self
pub fn allocate(ptr: usize, size: usize, thread_id: u64) -> Self
Create a new allocation event.
Constructing an event has no accounting side effect: task memory is
recorded once at the capture site (see Tracker::track_inner), otherwise
building an event — or replaying a recorded one — would double count.
Sourcepub fn reallocate_moved(
ptr: usize,
new_ptr: usize,
old_size: usize,
new_size: usize,
thread_id: u64,
) -> Self
pub fn reallocate_moved( ptr: usize, new_ptr: usize, old_size: usize, new_size: usize, thread_id: u64, ) -> Self
Create a migrating reallocation event.
reallocate() describes a block that stayed at ptr; this variant records
that the allocator returned a different address, so reconstruction can close
the old binding and open one at new_ptr.
Sourcepub fn deallocate(ptr: usize, size: usize, thread_id: u64) -> Self
pub fn deallocate(ptr: usize, size: usize, thread_id: u64) -> Self
Create a new deallocation event
Sourcepub fn reallocate(
ptr: usize,
old_size: usize,
new_size: usize,
thread_id: u64,
) -> Self
pub fn reallocate( ptr: usize, old_size: usize, new_size: usize, thread_id: u64, ) -> Self
Create a new reallocation event
Sourcepub fn metadata(
var_name: String,
type_name: String,
thread_id: u64,
size: usize,
) -> Self
pub fn metadata( var_name: String, type_name: String, thread_id: u64, size: usize, ) -> Self
Create a new metadata event for Container/Value types (no heap allocation)
Sourcepub fn clone_event(
source_ptr: usize,
target_ptr: usize,
size: usize,
thread_id: u64,
var_name: Option<String>,
type_name: Option<String>,
) -> Self
pub fn clone_event( source_ptr: usize, target_ptr: usize, size: usize, thread_id: u64, var_name: Option<String>, type_name: Option<String>, ) -> Self
Create a new clone event
Sourcepub fn borrow(ptr: usize, size: usize, thread_id: u64, is_mutable: bool) -> Self
pub fn borrow(ptr: usize, size: usize, thread_id: u64, is_mutable: bool) -> Self
Create a new borrow event
Sourcepub fn now() -> u64
pub fn now() -> u64
Get current timestamp in nanoseconds Returns 0 if system time is before Unix epoch (should not happen in practice)
Sourcepub fn with_var_name(self, name: String) -> Self
pub fn with_var_name(self, name: String) -> Self
Set variable name
Sourcepub fn with_type_name(self, name: String) -> Self
pub fn with_type_name(self, name: String) -> Self
Set type name
Sourcepub fn with_source_file(self, file: String) -> Self
pub fn with_source_file(self, file: String) -> Self
Set source file path
Sourcepub fn with_source_line(self, line: u32) -> Self
pub fn with_source_line(self, line: u32) -> Self
Set source line number
Sourcepub fn with_call_stack_hash(self, hash: u64) -> Self
pub fn with_call_stack_hash(self, hash: u64) -> Self
Set call stack hash
Sourcepub fn with_thread_name(self, name: String) -> Self
pub fn with_thread_name(self, name: String) -> Self
Set thread name
Sourcepub fn is_allocation(&self) -> bool
pub fn is_allocation(&self) -> bool
Check if this is an allocation event
Sourcepub fn is_deallocation(&self) -> bool
pub fn is_deallocation(&self) -> bool
Check if this is a deallocation event
Trait Implementations§
Source§impl Clone for MemoryEvent
impl Clone for MemoryEvent
Source§impl Debug for MemoryEvent
impl Debug for MemoryEvent
Source§impl<'de> Deserialize<'de> for MemoryEvent
impl<'de> Deserialize<'de> for MemoryEvent
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<&MemoryEvent> for DashboardEventDTO
impl From<&MemoryEvent> for DashboardEventDTO
Source§fn from(e: &MemoryEvent) -> Self
fn from(e: &MemoryEvent) -> Self
Auto Trait Implementations§
impl Forget for MemoryEvent
impl Freeze for MemoryEvent
impl RefUnwindSafe for MemoryEvent
impl Send for MemoryEvent
impl Sync for MemoryEvent
impl Unpin for MemoryEvent
impl UnsafeUnpin for MemoryEvent
impl UnwindSafe for MemoryEvent
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,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
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