(&self)
| 570 | } |
| 571 | |
| 572 | fn total_bytes(&self) -> (u64, u64) { |
| 573 | let mut live = 0_u64; |
| 574 | let mut allocated = 0_u64; |
| 575 | for entry in &self.stacks { |
| 576 | let stats = *entry.value(); |
| 577 | live = live.saturating_add(stats.live_bytes); |
| 578 | allocated = allocated.saturating_add(stats.alloc_bytes_total); |
| 579 | } |
| 580 | (live, allocated) |
| 581 | } |
| 582 | |
| 583 | fn on_alloc(&self, ptr: *mut u8, usable_bytes: usize) { |
| 584 | if ptr.is_null() || !self.enabled.load(Ordering::Relaxed) { |