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
// Copyright 2025-Present Datadog, Inc. https://www.datadoghq.com/
// SPDX-License-Identifier: Apache-2.0
/*
* Slow path for dd_allocation_created. We only arrive here when the paired
* dd_allocation_requested_slow decided to sample (req.weight > 0).
*
* Applies the architecture-specific sample flag to raw (tagging the pointer
* on arm64, writing a header magic word on x86-64) to produce the
* user-visible pointer, then fires the ddheap:alloc USDT so an attached
* profiler can record the sample. Finally closes the reentry guard that
* dd_allocation_requested_slow opened.
*
* raw may be NULL if the underlying allocator failed; in that case we skip
* the flag and USDT but still close the guard.
*
* TODO: on x86-64, consider abandoning the sample when raw falls within
* DD_HEADER_BYTES of a page boundary. The free-side fast path already bails
* in that case (to avoid reading before the page), so those allocations will
* never emit a ddheap:free. Dropping them at alloc time would keep the
* alloc/free pair balanced at the cost of occasionally missing a sample.
*
* (ddprof: AllocTrackerHelper::track / AllocationTracker push_alloc_sample)
*/
void *