1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
//! Tier 2 backtrace capture for `mod-alloc`.
//!
//! Behind the `backtraces` cargo feature. Each tracked allocation
//! captures up to 8 frames of its call site via inline frame-
//! pointer walking on `x86_64` and `aarch64`, aggregates into a
//! process-wide table keyed by frame hash, and exposes the result
//! via [`ModAlloc::call_sites`](crate::ModAlloc::call_sites).
//!
//! Symbolication (resolving frame addresses to function names)
//! lands in `v0.9.2`. DHAT-format JSON output lands in `v0.9.3`.
//!
//! ## Requirements
//!
//! The user must compile with frame pointers enabled. `build.rs`
//! emits a warning at build time if `RUSTFLAGS` is missing
//! `-C force-frame-pointers=yes`. Without frame pointers, traces
//! return zero or one frame and the per-call-site report has a
//! single uninformative bucket.
//!
//! ## Configuration
//!
//! Aggregation-table size is controlled by the `MOD_ALLOC_BUCKETS`
//! environment variable at process start. Default is 4,096
//! buckets (~384 KB). The value is rounded up to the next power
//! of two and clamped to `[64, 1,048,576]`.
pub
pub
pub
pub
pub
pub
pub
pub use ;
use current_fp;
use current_stack_bounds;
use ;
/// Capture and record one event at the call site of this function.
///
/// Called from the `GlobalAlloc` impl after the Tier 1 counter
/// update on every tracked alloc / alloc_zeroed / realloc event.
/// `size` is the bytes attributed to this event (per-event policy
/// matches `dhat`: alloc reports its size, realloc reports
/// new_size including shrinks).
///
/// Marked `#[inline(always)]` so the captured FP corresponds to
/// the calling `alloc` method, not this helper.
pub