mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-19 12:56:12 +00:00
jemalloc and triomphe
This commit is contained in:
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