From 6d14e9e441cf9b1f8e9dd2c3aa7aa013c7215105 Mon Sep 17 00:00:00 2001 From: "Sijie.Sun" Date: Fri, 8 Aug 2025 17:54:39 +0800 Subject: [PATCH] fix jemalloc prof feature (#1201) --- easytier/Cargo.toml | 4 +++- easytier/src/easytier-core.rs | 5 +++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/easytier/Cargo.toml b/easytier/Cargo.toml index 202587a..9a70c7b 100644 --- a/easytier/Cargo.toml +++ b/easytier/Cargo.toml @@ -249,7 +249,9 @@ windows-sys = { version = "0.52", features = [ winapi = { version = "0.3.9", features = ["impl-default"] } [target.'cfg(not(windows))'.dependencies] -jemallocator = { package = "tikv-jemallocator", version = "0.6.0", optional = true } +jemallocator = { package = "tikv-jemallocator", version = "0.6.0", optional = true, features = [ + "unprefixed_malloc_on_supported_platforms" +] } jemalloc-ctl = { package = "tikv-jemalloc-ctl", version = "0.6.0", optional = true, features = [ ] } jemalloc-sys = { package = "tikv-jemalloc-sys", version = "0.6.0", features = [ diff --git a/easytier/src/easytier-core.rs b/easytier/src/easytier-core.rs index c64bcf2..291d4b4 100644 --- a/easytier/src/easytier-core.rs +++ b/easytier/src/easytier-core.rs @@ -52,6 +52,11 @@ use jemalloc_ctl::{epoch, stats, Access as _, AsName as _}; #[global_allocator] static ALLOC: jemallocator::Jemalloc = jemallocator::Jemalloc; +#[cfg(feature = "jemalloc-prof")] +#[allow(non_upper_case_globals)] +#[export_name = "malloc_conf"] +pub static malloc_conf: &[u8] = b"prof:true,prof_active:true,lg_prof_sample:19\0"; + fn set_prof_active(_active: bool) { #[cfg(feature = "jemalloc-prof")] {