From 9c7950e8fe4beae63a0a6f6a3d310b5e33e39420 Mon Sep 17 00:00:00 2001 From: strawberry Date: Sun, 28 Apr 2024 02:01:11 -0400 Subject: [PATCH 1/2] set `--disable-stats` if `stats` feature is not enabled jemalloc defaults to enabling stats if `--enable-stats` is not present and `--disable-stats` was not set: https://github.com/jemalloc/jemalloc/blob/fa451de17fff73cc03c31ec8cd817d62927d1ff9/configure.ac#L1331-L1333 Signed-off-by: strawberry --- jemalloc-sys/build.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/jemalloc-sys/build.rs b/jemalloc-sys/build.rs index dc07fc35d..738004cc5 100644 --- a/jemalloc-sys/build.rs +++ b/jemalloc-sys/build.rs @@ -265,6 +265,9 @@ fn main() { if env::var("CARGO_FEATURE_STATS").is_ok() { info!("CARGO_FEATURE_STATS set"); cmd.arg("--enable-stats"); + } else { + info!("CARGO_FEATURE_STATS not set"); + cmd.arg("--disable-stats"); } if env::var("CARGO_FEATURE_DISABLE_INITIAL_EXEC_TLS").is_ok() { From 9924de9da2f2ffd9038e9d4b47d15d6a82061643 Mon Sep 17 00:00:00 2001 From: strawberry Date: Sun, 28 Apr 2024 23:35:46 -0400 Subject: [PATCH 2/2] add stats as a default feature to avoid breakage the stats feature was always enabled by default and never respected if someone were to remove the stats feature as no logic was added for setting `--disable-stats`. to avoid breaking other user's setups who are relying on this behaviour, set stats as a default feature. Signed-off-by: strawberry --- jemalloc-sys/Cargo.toml | 2 +- jemallocator/Cargo.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/jemalloc-sys/Cargo.toml b/jemalloc-sys/Cargo.toml index 4c30478a1..7f716427a 100644 --- a/jemalloc-sys/Cargo.toml +++ b/jemalloc-sys/Cargo.toml @@ -32,7 +32,7 @@ libc = { version = "^0.2.8", default-features = false } cc = "^1.0.13" [features] -default = ["background_threads_runtime_support"] +default = ["stats", "background_threads_runtime_support"] profiling = [] debug = [] background_threads_runtime_support = [] diff --git a/jemallocator/Cargo.toml b/jemallocator/Cargo.toml index 010b99c6f..58954543f 100644 --- a/jemallocator/Cargo.toml +++ b/jemallocator/Cargo.toml @@ -41,7 +41,7 @@ paste = "1" tikv-jemalloc-ctl = { path = "../jemalloc-ctl", version = "0.5.0" } [features] -default = ["background_threads_runtime_support"] +default = ["stats", "background_threads_runtime_support"] alloc_trait = [] profiling = ["tikv-jemalloc-sys/profiling"] debug = ["tikv-jemalloc-sys/debug"]