Fix malloc_utils features (sysmalloc) (#7770)

Follow-up to:

- https://github.com/sigp/lighthouse/pull/7764

The `heaptrack` feature added in my previous PR was ineffective, because the jemalloc feature was turned on by the Linux target-specific dependency.

This PR tweaks the features such that:

- The jemalloc feature is just used to control whether jemalloc is compiled in. It is enabled on Linux by the target-specific dependency (see `lighthouse/Cargo.toml`), and completely disabled on Windows.
- If the `sysmalloc` feature is set on Linux then it overrides jemalloc when selecting an allocator, _even if_ the jemalloc feature is enabled (and the jemalloc dep was compiled).
This commit is contained in:
Michael Sproul
2025-08-15 13:46:38 +10:00
committed by GitHub
parent 90fa7c216e
commit 317dc0f56c
8 changed files with 61 additions and 36 deletions

View File

@@ -11,7 +11,6 @@ normal = ["malloc_utils"]
[features]
portable = ["bls/supranational-portable"]
fake_crypto = ['bls/fake_crypto']
jemalloc = ["malloc_utils/jemalloc"]
[dependencies]
account_utils = { workspace = true }
@@ -31,7 +30,6 @@ hex = { workspace = true }
lighthouse_network = { workspace = true }
lighthouse_version = { workspace = true }
log = { workspace = true }
malloc_utils = { workspace = true }
rayon = { workspace = true }
serde = { workspace = true }
serde_json = { workspace = true }
@@ -44,3 +42,9 @@ tracing-subscriber = { workspace = true }
tree_hash = { workspace = true }
types = { workspace = true }
validator_dir = { workspace = true }
[target.'cfg(not(target_os = "windows"))'.dependencies]
malloc_utils = { workspace = true, features = ["jemalloc"] }
[target.'cfg(target_os = "windows")'.dependencies]
malloc_utils = { workspace = true, features = [] }