mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-03 00:31:50 +00:00
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).
40 lines
1.4 KiB
TOML
40 lines
1.4 KiB
TOML
[package]
|
|
name = "malloc_utils"
|
|
version = "0.1.0"
|
|
authors = ["Paul Hauner <paul@paulhauner.com>"]
|
|
edition = { workspace = true }
|
|
|
|
# Features are not rich enough to express the complexity of our defaults, so we choose to just
|
|
# use the jemalloc feature to control whether the dependency is compiled, but avoid using it if
|
|
# the `sysmalloc` feature is set.
|
|
#
|
|
# On Windows, setting the jemalloc feature will result in a compile-time error.
|
|
[features]
|
|
default = []
|
|
mallinfo2 = []
|
|
# The jemalloc feature enables the compilation of jemalloc dependencies. Jemalloc is also the
|
|
# default allocator, unless `sysmalloc` is set.
|
|
#
|
|
# It should be turned off on Windows.
|
|
jemalloc = ["tikv-jemalloc-ctl", "tikv-jemallocator"]
|
|
jemalloc-profiling = ["tikv-jemallocator/profiling"]
|
|
# Force the use of system malloc (or glibc) rather than jemalloc.
|
|
# This is a no-op on Windows where jemalloc is always disabled.
|
|
sysmalloc = []
|
|
|
|
[dependencies]
|
|
libc = "0.2.79"
|
|
metrics = { workspace = true }
|
|
parking_lot = { workspace = true }
|
|
tikv-jemalloc-ctl = { version = "0.6.0", optional = true, features = ["stats"] }
|
|
|
|
[target.'cfg(not(target_os = "linux"))'.dependencies]
|
|
tikv-jemallocator = { version = "0.6.0", optional = true, features = ["stats"] }
|
|
|
|
# Jemalloc's background_threads feature requires Linux (pthreads).
|
|
[target.'cfg(target_os = "linux")'.dependencies]
|
|
tikv-jemallocator = { version = "0.6.0", optional = true, features = [
|
|
"stats",
|
|
"background_threads",
|
|
] }
|