mirror of
https://github.com/sigp/lighthouse.git
synced 2026-04-18 21:38:31 +00:00
jemalloc and triomphe
This commit is contained in:
@@ -11,6 +11,8 @@ lighthouse_metrics = { path = "../lighthouse_metrics" }
|
||||
lazy_static = "1.4.0"
|
||||
libc = "0.2.79"
|
||||
parking_lot = "0.11.0"
|
||||
jemallocator = { version = "0.3.0", optional = true }
|
||||
|
||||
[features]
|
||||
mallinfo2 = []
|
||||
jemalloc = ["jemallocator"]
|
||||
|
||||
2
common/malloc_utils/src/jemalloc.rs
Normal file
2
common/malloc_utils/src/jemalloc.rs
Normal file
@@ -0,0 +1,2 @@
|
||||
#[global_allocator]
|
||||
static ALLOC: jemallocator::Jemalloc = jemallocator::Jemalloc;
|
||||
@@ -24,18 +24,27 @@
|
||||
//! detecting `glibc` are best-effort. If this crate throws errors about undefined external
|
||||
//! functions, then try to compile with the `not_glibc_interface` module.
|
||||
|
||||
#[cfg(all(target_os = "linux", not(target_env = "musl")))]
|
||||
#[cfg(all(
|
||||
target_os = "linux",
|
||||
not(any(target_env = "musl", feature = "jemalloc"))
|
||||
))]
|
||||
mod glibc;
|
||||
|
||||
#[cfg(feature = "jemalloc")]
|
||||
mod jemalloc;
|
||||
|
||||
pub use interface::*;
|
||||
|
||||
#[cfg(all(target_os = "linux", not(target_env = "musl")))]
|
||||
#[cfg(all(
|
||||
target_os = "linux",
|
||||
not(any(target_env = "musl", feature = "jemalloc"))
|
||||
))]
|
||||
mod interface {
|
||||
pub use crate::glibc::configure_glibc_malloc as configure_memory_allocator;
|
||||
pub use crate::glibc::scrape_mallinfo_metrics as scrape_allocator_metrics;
|
||||
}
|
||||
|
||||
#[cfg(any(not(target_os = "linux"), target_env = "musl"))]
|
||||
#[cfg(any(not(target_os = "linux"), target_env = "musl", feature = "jemalloc"))]
|
||||
mod interface {
|
||||
#[allow(dead_code, clippy::unnecessary_wraps)]
|
||||
pub fn configure_memory_allocator() -> Result<(), String> {
|
||||
|
||||
Reference in New Issue
Block a user