Skip to content

Commit 1e42509

Browse files
committed
feat(memtrack): always try to attach to libc-compatible API
1 parent dc2de19 commit 1e42509

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

crates/memtrack/src/ebpf/memtrack.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -282,17 +282,20 @@ impl MemtrackBpf {
282282
self.attach_libcpp_probes(lib_path)
283283
}
284284
AllocatorKind::Jemalloc => {
285-
// Try C++ operators (jemalloc exports these for C++ programs)
285+
// Jemalloc exposes libc/libcpp compatible allocator functions:
286+
let _ = self.attach_libc_probes(lib_path);
286287
let _ = self.attach_libcpp_probes(lib_path);
287288
self.attach_jemalloc_probes(lib_path)
288289
}
289290
AllocatorKind::Mimalloc => {
290-
// Try C++ operators (mimalloc exports these for C++ programs)
291+
// Mimalloc exposes libc/libcpp compatible allocator functions:
292+
let _ = self.attach_libc_probes(lib_path);
291293
let _ = self.attach_libcpp_probes(lib_path);
292294
self.attach_mimalloc_probes(lib_path)
293295
}
294296
AllocatorKind::Tcmalloc => {
295-
// Try C++ operators (tcmalloc exports these for C++ programs)
297+
// Tcmalloc exposes libc/libcpp compatible allocator functions:
298+
let _ = self.attach_libc_probes(lib_path);
296299
let _ = self.attach_libcpp_probes(lib_path);
297300
self.attach_tcmalloc_probes(lib_path)
298301
}
@@ -416,7 +419,6 @@ impl MemtrackBpf {
416419
/// See:
417420
/// - https://github.com/google/tcmalloc/blob/master/docs/reference.md
418421
/// - https://github.com/gperftools/gperftools/blob/a47243150ec41097602730ff8779fafcc172d1fb/src/tcmalloc.cc#L178-L190
419-
420422
fn attach_tcmalloc_probes(&mut self, lib_path: &Path) -> Result<()> {
421423
self.attach_standard_probes(lib_path, &["tc_"], &[])?;
422424

0 commit comments

Comments
 (0)