Skip to content
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions libdd-profiling-heap-sampler/include/datadog/heap/probes.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,16 @@
*/
void dd_probe_alloc(void *user, uint64_t size, uint64_t weight);

#if DD_HEAP_LIVE_TRACKING
Comment thread
scottgerring marked this conversation as resolved.
Outdated
/*
* Emits the `ddheap:free` USDT.
* ptr - user-visible pointer being freed
*
* Only available when compiled with live-heap tracking. The absence of
* the `ddheap:free` note in .note.stapsdt signals to external profilers
* that this binary does not support live-heap correlation.
*/
void dd_probe_free(void *ptr);
#endif

#endif
2 changes: 2 additions & 0 deletions libdd-profiling-heap-sampler/src/allocation_freed.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ dd_alloc_freed_t dd_allocation_freed_slow(void *ptr, void *raw, size_t size,
size_t alignment) {
/* Fire with the user-visible pointer, matching what was reported at alloc
* time, so the profiler can correlate the two events by address. */
#if DD_HEAP_LIVE_TRACKING
dd_probe_free(ptr);
#endif

dd_alloc_freed_t out = {
/* Return the raw pointer so the caller passes the real allocation base
Expand Down
4 changes: 3 additions & 1 deletion libdd-profiling-heap-sampler/src/probes.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ void dd_probe_alloc(void *user, uint64_t size, uint64_t weight) {
USDT(ddheap, alloc, user, size, weight);
}

#if DD_HEAP_LIVE_TRACKING
void dd_probe_free(void *ptr) {
USDT(ddheap, free, ptr);
}
}
#endif
Loading