mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
chore: enable jemalloc by default on unix (#3735)
This commit is contained in:
@ -37,8 +37,6 @@ reth-basic-payload-builder = { path = "../../crates/payload/basic" }
|
||||
reth-discv4 = { path = "../../crates/net/discv4" }
|
||||
reth-metrics = { workspace = true }
|
||||
reth-prune = { path = "../../crates/prune" }
|
||||
jemallocator = { version = "0.5.0", optional = true }
|
||||
jemalloc-ctl = { version = "0.5.0", optional = true }
|
||||
|
||||
# crypto
|
||||
secp256k1 = { workspace = true, features = ["global-context", "rand-std", "recovery"] }
|
||||
@ -88,7 +86,12 @@ pretty_assertions = "1.3.0"
|
||||
humantime = "2.1.0"
|
||||
const-str = "0.5.6"
|
||||
|
||||
[target.'cfg(not(windows))'.dependencies]
|
||||
jemallocator = { version = "0.5.0", optional = true }
|
||||
jemalloc-ctl = { version = "0.5.0", optional = true }
|
||||
|
||||
[features]
|
||||
default = ["jemalloc"]
|
||||
jemalloc = ["dep:jemallocator", "dep:jemalloc-ctl"]
|
||||
jemalloc-prof = ["jemalloc", "jemallocator?/profiling"]
|
||||
min-error-logs = ["tracing/release_max_level_error"]
|
||||
|
||||
@ -40,5 +40,5 @@ pub mod test_vectors;
|
||||
pub mod utils;
|
||||
pub mod version;
|
||||
|
||||
#[cfg(feature = "jemalloc")]
|
||||
#[cfg(all(feature = "jemalloc", unix))]
|
||||
use jemallocator as _;
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
// We use jemalloc for performance reasons
|
||||
#[cfg(feature = "jemalloc")]
|
||||
#[cfg(all(feature = "jemalloc", unix))]
|
||||
#[global_allocator]
|
||||
static ALLOC: jemallocator::Jemalloc = jemallocator::Jemalloc;
|
||||
|
||||
|
||||
@ -121,7 +121,7 @@ pub(crate) async fn initialize(
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[cfg(feature = "jemalloc")]
|
||||
#[cfg(all(feature = "jemalloc", unix))]
|
||||
fn collect_memory_stats() {
|
||||
use jemalloc_ctl::{epoch, stats};
|
||||
use reth_metrics::metrics::gauge;
|
||||
@ -169,7 +169,7 @@ fn collect_memory_stats() {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "jemalloc")]
|
||||
#[cfg(all(feature = "jemalloc", unix))]
|
||||
fn describe_memory_stats() {
|
||||
use reth_metrics::metrics::describe_gauge;
|
||||
|
||||
@ -206,8 +206,8 @@ fn describe_memory_stats() {
|
||||
);
|
||||
}
|
||||
|
||||
#[cfg(not(feature = "jemalloc"))]
|
||||
#[cfg(not(all(feature = "jemalloc", unix)))]
|
||||
fn collect_memory_stats() {}
|
||||
|
||||
#[cfg(not(feature = "jemalloc"))]
|
||||
#[cfg(not(all(feature = "jemalloc", unix)))]
|
||||
fn describe_memory_stats() {}
|
||||
|
||||
Reference in New Issue
Block a user