#[cfg(feature = "malloc_hoard")]
pub use self::hoard::*;
#[cfg(feature = "malloc_jemalloc")]
pub use self::jemalloc::*;
#[cfg(not(any(
feature = "malloc_jemalloc",
feature = "malloc_mimalloc",
feature = "malloc_hoard",
)))]
pub use self::libc_malloc::*;
#[cfg(feature = "malloc_mimalloc")]
pub use self::mimalloc::*;
pub const BYTES_IN_MALLOC_PAGE: usize = 1 << LOG_BYTES_IN_MALLOC_PAGE;
#[cfg(feature = "malloc_jemalloc")]
mod jemalloc {
pub const LOG_BYTES_IN_MALLOC_PAGE: u8 = crate::util::constants::LOG_BYTES_IN_PAGE;
pub use jemalloc_sys::{calloc, free, malloc, realloc};
pub use jemalloc_sys::posix_memalign;
pub use jemalloc_sys::malloc_usable_size;
}
#[cfg(feature = "malloc_mimalloc")]
mod mimalloc {
pub const LOG_BYTES_IN_MALLOC_PAGE: u8 = 16;
pub use mimalloc_sys::{
mi_calloc as calloc, mi_free as free, mi_malloc as malloc, mi_realloc as realloc,
};
pub use mimalloc_sys::mi_posix_memalign as posix_memalign;
pub use mimalloc_sys::mi_malloc_usable_size as malloc_usable_size;
}
#[cfg(feature = "malloc_hoard")]
mod hoard {
pub const LOG_BYTES_IN_MALLOC_PAGE: u8 = crate::util::constants::LOG_BYTES_IN_PAGE;
pub use hoard_sys::{calloc, free, malloc, realloc};
pub use hoard_sys::posix_memalign;
pub use hoard_sys::malloc_usable_size;
}
#[cfg(not(any(
feature = "malloc_jemalloc",
feature = "malloc_mimalloc",
feature = "malloc_hoard",
)))]
mod libc_malloc {
pub const LOG_BYTES_IN_MALLOC_PAGE: u8 = crate::util::constants::LOG_BYTES_IN_PAGE;
pub use libc::{calloc, free, malloc, realloc};
pub use libc::posix_memalign;
pub use libc::malloc_usable_size;
}