pub struct AllocLeakDetector { /* private fields */ }Expand description
Sequential allocation leak detector combining CUSUM and e-process.
Feed per-frame allocation counts via observe. The detector maintains
running estimates of the baseline mean and standard deviation, then
applies both CUSUM and an e-process test to the standardised residuals.
An alert triggers when either detector fires. The evidence ledger records all intermediate state for post-mortem diagnostics.
Implementations§
Source§impl AllocLeakDetector
impl AllocLeakDetector
Sourcepub fn new(config: LeakDetectorConfig) -> Self
pub fn new(config: LeakDetectorConfig) -> Self
Create a new detector with the given configuration.
Sourcepub fn observe(&mut self, value: f64) -> LeakAlert
pub fn observe(&mut self, value: f64) -> LeakAlert
Observe a new allocation count (or byte total) for this frame.
Returns a LeakAlert indicating whether the detector triggered.
Sourcepub fn observe_unrecorded(&mut self, value: f64) -> LeakAlert
pub fn observe_unrecorded(&mut self, value: f64) -> LeakAlert
Observe without retaining a per-frame ledger entry.
Long-running runtimes export their own snapshots and must not accumulate an unbounded diagnostic history inside the detector.
Sourcepub fn cusum_upper(&self) -> f64
pub fn cusum_upper(&self) -> f64
Current CUSUM upper statistic.
Sourcepub fn cusum_lower(&self) -> f64
pub fn cusum_lower(&self) -> f64
Current CUSUM lower statistic.
Sourcepub fn ledger(&self) -> &[EvidenceEntry]
pub fn ledger(&self) -> &[EvidenceEntry]
Access the full evidence ledger.
Sourcepub fn cusum_threshold(&self) -> f64
pub fn cusum_threshold(&self) -> f64
CUSUM threshold for either directional statistic.