Skip to content

Commit 16ffc38

Browse files
committed
fix(memtrack): classify unprefixed jemalloc builds as jemalloc
Distro libjemalloc is built without the je_ symbol prefix, so symbol classification missed it and fell through to libc++ (jemalloc exports operator new), leaving plain malloc/aligned_alloc unprobed. Match on mallocx, which keeps its name in unprefixed builds and is unique to jemalloc.
1 parent d33b870 commit 16ffc38

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

crates/memtrack/src/allocators/static_linked.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,12 @@ impl AllocatorKind {
1010
match self {
1111
AllocatorKind::Libc => &["malloc", "free"],
1212
AllocatorKind::LibCpp => &["_Znwm", "_Znam", "_ZdlPv", "_ZdaPv"],
13-
AllocatorKind::Jemalloc => &["_rjem_malloc", "je_malloc", "je_malloc_default"],
13+
// "mallocx" covers unprefixed jemalloc builds (e.g. distro
14+
// libjemalloc.so): the extended API keeps its name when the je_
15+
// prefix is disabled, and no other allocator exports it.
16+
AllocatorKind::Jemalloc => {
17+
&["_rjem_malloc", "je_malloc", "je_malloc_default", "mallocx"]
18+
}
1419
AllocatorKind::Mimalloc => &["mi_malloc_aligned", "mi_malloc", "mi_free"],
1520
AllocatorKind::Tcmalloc => &["tc_malloc", "tc_free", "tc_version"],
1621
}

0 commit comments

Comments
 (0)