Skip to content

Add heaptrack support #7764

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jul 21, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -289,5 +289,9 @@ panic = "abort"
codegen-units = 1
overflow-checks = true

[profile.release-debug]
inherits = "release"
debug = true

[patch.crates-io]
quick-protobuf = { git = "https://github.com/sigp/quick-protobuf.git", rev = "681f413312404ab6e51f0b46f39b0075c6f4ebfd" }
12 changes: 7 additions & 5 deletions lighthouse/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,10 @@ beacon-node-leveldb = ["store/leveldb"]
beacon-node-redb = ["store/redb"]
# Supports console subscriber for debugging
console-subscriber = ["console-subscriber/default"]
# Turns off jemalloc so that heaptrack may be used to analyse memory usage.
heaptrack = []

# Deprecated. This is now enabled by default on non windows targets.
# Deprecated. This is now enabled by default on non windows targets (unless heaptrack is enabled).
jemalloc = []

[dependencies]
Expand Down Expand Up @@ -71,12 +73,12 @@ unused_port = { workspace = true }
validator_client = { workspace = true }
validator_manager = { path = "../validator_manager" }

[target.'cfg(not(target_os = "windows"))'.dependencies]
malloc_utils = { workspace = true, features = ["jemalloc"] }

[target.'cfg(target_os = "windows")'.dependencies]
[target.'cfg(any(target_os = "windows", features = "heaptrack"))'.dependencies]
malloc_utils = { workspace = true }

[target.'cfg(not(any(target_os = "windows", features = "heaptrack")))'.dependencies]
malloc_utils = { workspace = true, features = ["jemalloc"] }

[dev-dependencies]
beacon_node_fallback = { workspace = true }
beacon_processor = { workspace = true }
Expand Down
4 changes: 2 additions & 2 deletions lighthouse/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,11 @@ fn bls_hardware_acceleration() -> bool {
}

fn allocator_name() -> String {
#[cfg(target_os = "windows")]
#[cfg(any(feature = "heaptrack", target_os = "windows"))]
{
"system".to_string()
}
#[cfg(not(target_os = "windows"))]
#[cfg(not(any(feature = "heaptrack", target_os = "windows")))]
match malloc_utils::jemalloc::page_size() {
Ok(page_size) => format!("jemalloc ({}K)", page_size / 1024),
Err(e) => format!("jemalloc (error: {e:?})"),
Expand Down