Skip to content
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

feat(starknet_sequencer_node): set jemalloc as global allocator #3897

Merged
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
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions crates/blockifier/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ workspace = true

[features]
cairo_native = ["dep:cairo-native", "starknet_sierra_multicompile/cairo_native"]
jemalloc = ["dep:tikv-jemallocator"]
native_blockifier = []
reexecution = ["transaction_serde"]
testing = [
Expand Down Expand Up @@ -67,7 +66,6 @@ strum.workspace = true
strum_macros.workspace = true
tempfile.workspace = true
thiserror.workspace = true
tikv-jemallocator = { workspace = true, optional = true }
tokio = { workspace = true, optional = true, features = ["macros", "rt-multi-thread"] }
toml.workspace = true
tracing = { workspace = true, optional = true }
Expand Down
5 changes: 0 additions & 5 deletions crates/blockifier/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,6 @@
// when converting usize to u128.
#![cfg(any(target_pointer_width = "16", target_pointer_width = "32", target_pointer_width = "64",))]

#[cfg(feature = "jemalloc")]
// Override default allocator.
#[global_allocator]
static ALLOC: tikv_jemallocator::Jemalloc = tikv_jemallocator::Jemalloc;

pub mod abi;
pub mod blockifier;
pub mod bouncer;
Expand Down
1 change: 0 additions & 1 deletion crates/native_blockifier/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ name = "native_blockifier"
crate-type = ["cdylib"]

[dependencies]
# TODO(Dori, 1/1/2025): Add the "jemalloc" feature to the blockifier crate when possible.
blockifier = { workspace = true, features = ["native_blockifier"] }
cairo-lang-starknet-classes.workspace = true
cairo-vm.workspace = true
Expand Down
8 changes: 8 additions & 0 deletions crates/starknet_infra_utils/src/global_allocator.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/// Override default allocator.
#[macro_export]
macro_rules! set_global_allocator {
() => {
#[global_allocator]
static ALLOC: tikv_jemallocator::Jemalloc = tikv_jemallocator::Jemalloc;
};
}
1 change: 1 addition & 0 deletions crates/starknet_infra_utils/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
pub mod command;
pub mod global_allocator;
pub mod path;
pub mod run_until;
pub mod tasks;
Expand Down
4 changes: 4 additions & 0 deletions crates/starknet_sequencer_node/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ starknet_sierra_multicompile.workspace = true
starknet_sierra_multicompile_types.workspace = true
starknet_state_sync.workspace = true
starknet_state_sync_types.workspace = true
tikv-jemallocator.workspace = true
tokio.workspace = true
tracing.workspace = true
url.workspace = true
Expand All @@ -57,3 +58,6 @@ mempool_test_utils.path = "../mempool_test_utils"
pretty_assertions.workspace = true
serde_json.workspace = true
starknet_infra_utils.path = "../starknet_infra_utils"

[package.metadata.cargo-machete]
ignored = ["tikv-jemallocator"]
3 changes: 3 additions & 0 deletions crates/starknet_sequencer_node/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,15 @@ use std::process::exit;

use papyrus_config::validators::config_validate;
use papyrus_config::ConfigError;
use starknet_infra_utils::set_global_allocator;
use starknet_sequencer_infra::trace_util::configure_tracing;
use starknet_sequencer_node::config::node_config::SequencerNodeConfig;
use starknet_sequencer_node::servers::run_component_servers;
use starknet_sequencer_node::utils::create_node_modules;
use tracing::{error, info};

set_global_allocator!();

#[tokio::main]
async fn main() -> anyhow::Result<()> {
configure_tracing().await;
Expand Down
Loading