feat: use mimalloc v2 as default allocator
This commit is contained in:
+9
-2
@@ -79,10 +79,17 @@ tui-logger = { version = "=0.18.2", features = [
|
||||
], optional = true }
|
||||
url = "=2.5.8"
|
||||
|
||||
[target.'cfg(all(any(target_arch = "aarch64", target_arch = "x86_64"), any(all(target_os = "linux", any(target_env = "musl", target_env = "gnu")), target_os = "macos", all(target_os = "windows", target_env = "msvc"))))'.dependencies]
|
||||
mimalloc-auto = { package = "mimalloc", version = "=0.1.50", features = [
|
||||
"no_thp",
|
||||
"override",
|
||||
"v2"
|
||||
], optional = true }
|
||||
|
||||
[features]
|
||||
# default = ["auto-allocator"]
|
||||
default = ["auto-allocator"]
|
||||
__mimalloc = ["dep:mimalloc"]
|
||||
auto-allocator = ["dep:mimalloc"]
|
||||
auto-allocator = ["dep:mimalloc-auto"]
|
||||
dhat = ["dep:dhat"]
|
||||
jemalloc = ["dep:tikv-jemallocator"]
|
||||
mimalloc_v2 = ["__mimalloc", "mimalloc/v2"]
|
||||
|
||||
+13
-8
@@ -69,6 +69,18 @@ use tracing_subscriber::{
|
||||
layer::SubscriberExt as _, util::SubscriberInitExt as _,
|
||||
};
|
||||
|
||||
#[cfg(all(
|
||||
feature = "auto-allocator",
|
||||
any(target_arch = "aarch64", target_arch = "x86_64"),
|
||||
any(
|
||||
all(target_os = "linux", any(target_env = "musl", target_env = "gnu")),
|
||||
target_os = "macos",
|
||||
all(target_os = "windows", target_env = "msvc")
|
||||
),
|
||||
))]
|
||||
#[global_allocator]
|
||||
static GLOBAL: mimalloc_auto::MiMalloc = mimalloc_auto::MiMalloc;
|
||||
|
||||
#[cfg(feature = "dhat")]
|
||||
#[global_allocator]
|
||||
static GLOBAL: dhat::Alloc = dhat::Alloc;
|
||||
@@ -77,14 +89,7 @@ static GLOBAL: dhat::Alloc = dhat::Alloc;
|
||||
#[global_allocator]
|
||||
static GLOBAL: tikv_jemallocator::Jemalloc = tikv_jemallocator::Jemalloc;
|
||||
|
||||
#[cfg(any(
|
||||
all(
|
||||
feature = "auto-allocator",
|
||||
any(target_arch = "aarch64", target_arch = "x86_64"),
|
||||
any(target_os = "linux", target_os = "macos", target_os = "windows"),
|
||||
),
|
||||
feature = "__mimalloc"
|
||||
))]
|
||||
#[cfg(feature = "__mimalloc")]
|
||||
#[global_allocator]
|
||||
static GLOBAL: mimalloc::MiMalloc = mimalloc::MiMalloc;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user