fix: Use mimalloc for c/c++ code by default

This commit is contained in:
Jade Ellis committed 2026-11-21 15:21:56 +00:00
1 parent 43cf8cccdf
commit d4aec6ca5c
4 files changed
+6 -11

No files matched your search

+4
View File
@@ -31,9 +31,13 @@ jemalloc = [
"dep:tikv-jemalloc-ctl",
"dep:tikv-jemallocator",
]
# Uses mimalloc for Rust allocations and, via `override`, exports
# malloc/free/etc. so C/C++ dependencies (RocksDB, zstd, lz4, ...) use it too.
# Mutually exclusive with `jemalloc` on non-MSVC targets.
mimalloc = [
"dep:libmimalloc-sys",
"dep:mimalloc",
"libmimalloc-sys/override",
]
jemalloc_conf = []
jemalloc_prof = [
+2
View File
@@ -9,6 +9,8 @@ pub(crate) use je::metric;
pub use je::{memory_stats, memory_usage, memory_usage_stats, trim};
// mimalloc
#[cfg(all(feature = "mimalloc", feature = "jemalloc", not(target_env = "msvc")))]
compile_error!("the `mimalloc` and `jemalloc` features are mutually exclusive");
#[cfg(all(feature = "mimalloc", any(target_env = "msvc", not(feature = "jemalloc"))))]
pub mod mimalloc;
#[cfg(all(feature = "mimalloc", any(target_env = "msvc", not(feature = "jemalloc"))))]
-7
View File
@@ -43,13 +43,6 @@ pub fn check(config: &Config) -> Result {
));
}
if cfg!(all(feature = "mimalloc", feature = "jemalloc", not(target_env = "msvc"))) {
warn!(
"mimalloc and jemalloc compile-time features are both enabled, this causes jemalloc \
to be used."
);
}
if cfg!(not(unix)) && config.unix_socket_path.is_some() {
return Err!(Config(
"unix_socket_path",
-4
View File
@@ -112,10 +112,6 @@ jemalloc = [
"conduwuit-core/jemalloc",
"conduwuit-service/jemalloc",
]
# Sets Rust's #[global_allocator] to mimalloc (C/C++ libraries such as RocksDB
# still use system libc malloc). On non-MSVC targets, `jemalloc` takes
# precedence if both are enabled, so build with `--no-default-features` and
# omit `jemalloc`/`standard` to use mimalloc.
mimalloc = [
"conduwuit-core/mimalloc",
]