2024-04-27 16:08:50 -07:00
|
|
|
//! Integration with allocators
|
2024-04-27 04:50:20 -07:00
|
|
|
|
2026-11-21 02:10:36 +00:00
|
|
|
// jemalloc
|
|
|
|
|
#[cfg(all(not(target_env = "msvc"), feature = "jemalloc"))]
|
2024-05-09 15:59:08 -07:00
|
|
|
pub mod je;
|
2026-11-21 02:10:36 +00:00
|
|
|
#[cfg(all(not(target_env = "msvc"), feature = "jemalloc"))]
|
2026-11-21 14:12:45 +00:00
|
|
|
pub(crate) use je::metric;
|
|
|
|
|
#[cfg(all(not(target_env = "msvc"), feature = "jemalloc"))]
|
2026-09-24 15:30:29 +02:00
|
|
|
pub use je::{memory_stats, memory_usage, memory_usage_stats, trim};
|
2024-04-27 04:50:20 -07:00
|
|
|
|
2026-11-21 02:10:36 +00:00
|
|
|
// mimalloc
|
2026-11-21 14:54:10 +00:00
|
|
|
#[cfg(all(feature = "mimalloc", feature = "jemalloc", not(target_env = "msvc")))]
|
|
|
|
|
compile_error!("the `mimalloc` and `jemalloc` features are mutually exclusive");
|
2026-11-21 02:10:36 +00:00
|
|
|
#[cfg(all(feature = "mimalloc", any(target_env = "msvc", not(feature = "jemalloc"))))]
|
2026-11-21 01:52:39 +00:00
|
|
|
pub mod mimalloc;
|
2026-11-21 02:24:59 +00:00
|
|
|
#[cfg(all(feature = "mimalloc", any(target_env = "msvc", not(feature = "jemalloc"))))]
|
2026-11-21 14:12:45 +00:00
|
|
|
pub(crate) use mimalloc::metric;
|
|
|
|
|
#[cfg(all(feature = "mimalloc", any(target_env = "msvc", not(feature = "jemalloc"))))]
|
2026-11-21 02:24:59 +00:00
|
|
|
pub use mimalloc::{memory_stats, memory_usage, memory_usage_stats, trim};
|
2024-04-27 16:08:50 -07:00
|
|
|
|
2026-11-21 02:10:36 +00:00
|
|
|
// default
|
2026-11-21 02:24:59 +00:00
|
|
|
#[cfg(all(not(feature = "mimalloc"), any(target_env = "msvc", not(feature = "jemalloc"))))]
|
2026-11-21 02:10:36 +00:00
|
|
|
pub mod default;
|
2026-11-21 02:24:59 +00:00
|
|
|
#[cfg(all(not(feature = "mimalloc"), any(target_env = "msvc", not(feature = "jemalloc"))))]
|
2026-11-21 14:12:45 +00:00
|
|
|
pub(crate) use default::metric;
|
|
|
|
|
#[cfg(all(not(feature = "mimalloc"), any(target_env = "msvc", not(feature = "jemalloc"))))]
|
2026-09-24 15:30:29 +02:00
|
|
|
pub use default::{memory_stats, memory_usage, memory_usage_stats, trim};
|