default to jemalloc when both hardened_malloc and jemalloc enabled.
Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
parent
3a51e18ce6
commit
0e46b750a0
4 changed files with 13 additions and 22 deletions
|
@ -1,3 +1,5 @@
|
|||
//! hmalloc allocator
|
||||
|
||||
#[global_allocator]
|
||||
static HMALLOC: hardened_malloc_rs::HardenedMalloc = hardened_malloc_rs::HardenedMalloc;
|
||||
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
//! jemalloc allocator
|
||||
|
||||
use std::ffi::{c_char, c_void};
|
||||
|
||||
use tikv_jemalloc_ctl as mallctl;
|
||||
|
|
|
@ -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};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue