diff --git a/src/core/alloc/hardened.rs b/src/core/alloc/hardened.rs index 4c9563cf..6727407f 100644 --- a/src/core/alloc/hardened.rs +++ b/src/core/alloc/hardened.rs @@ -1,3 +1,5 @@ +//! hmalloc allocator + #[global_allocator] static HMALLOC: hardened_malloc_rs::HardenedMalloc = hardened_malloc_rs::HardenedMalloc; diff --git a/src/core/alloc/je.rs b/src/core/alloc/je.rs index ebf3575f..e0628ef3 100644 --- a/src/core/alloc/je.rs +++ b/src/core/alloc/je.rs @@ -1,3 +1,5 @@ +//! jemalloc allocator + use std::ffi::{c_char, c_void}; use tikv_jemalloc_ctl as mallctl; diff --git a/src/core/alloc/mod.rs b/src/core/alloc/mod.rs index 4c42b1e6..7941a99c 100644 --- a/src/core/alloc/mod.rs +++ b/src/core/alloc/mod.rs @@ -1,27 +1,17 @@ //! Integration with allocators // jemalloc -#[cfg(all(not(target_env = "msvc"), feature = "jemalloc", not(feature = "hardened_malloc")))] +#[cfg(all(not(target_env = "msvc"), feature = "jemalloc"))] pub mod je; -#[cfg(all(not(target_env = "msvc"), feature = "jemalloc", not(feature = "hardened_malloc")))] +#[cfg(all(not(target_env = "msvc"), feature = "jemalloc"))] pub use je::{memory_stats, memory_usage}; -// hardened_malloc -//#[cfg(all(not(target_env = "msvc"), feature = "hardened_malloc", target_os = -//#[cfg(all(not(target_env "linux", not(feature = "jemalloc")))] -//pub mod hardened; -//#[cfg(all(not(target_env = "msvc"), feature = "hardened_malloc", target_os = -//#[cfg(all(not(target_env "linux", not(feature = "jemalloc")))] -//pub use hardened::{memory_stats, memory_usage}; +#[cfg(all(not(target_env = "msvc"), feature = "hardened_malloc", not(feature = "jemalloc")))] +pub mod hardened; +#[cfg(all(not(target_env = "msvc"), feature = "hardened_malloc", not(feature = "jemalloc")))] +pub use hardened::{memory_stats, memory_usage}; -// default, enabled when none or multiple of the above are enabled -#[cfg(any( - not(any(feature = "jemalloc", feature = "hardened_malloc")), - all(feature = "jemalloc", feature = "hardened_malloc"), -))] +#[cfg(any(target_env = "msvc", all(not(feature = "hardened_malloc"), not(feature = "jemalloc"))))] pub mod default; -#[cfg(any( - not(any(feature = "jemalloc", feature = "hardened_malloc")), - all(feature = "jemalloc", feature = "hardened_malloc"), -))] +#[cfg(any(target_env = "msvc", all(not(feature = "hardened_malloc"), not(feature = "jemalloc"))))] pub use default::{memory_stats, memory_usage}; diff --git a/src/core/config/check.rs b/src/core/config/check.rs index 9ee25962..24a9ac9c 100644 --- a/src/core/config/check.rs +++ b/src/core/config/check.rs @@ -14,10 +14,7 @@ pub fn check(config: &Config) -> Result<(), Error> { } if cfg!(feature = "hardened_malloc") && cfg!(feature = "jemalloc") { - warn!( - "hardened_malloc and jemalloc were built together, this causes neither to be used. Conduwuit will still \ - function, but consider rebuilding and pick one as this is now no-op." - ); + warn!("hardened_malloc and jemalloc are both enabled, this causes jemalloc to be used."); } if config.unix_socket_path.is_some() && !cfg!(unix) {