mirror of
https://forgejo.ellis.link/continuwuation/continuwuity.git
synced 2026-11-22 08:27:32 +00:00
fix: Use mimalloc for c/c++ code by default
This commit is contained in:
4 files changed
+6
-11
No files matched your search
@@ -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 = [
|
||||
|
||||
@@ -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"))))]
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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",
|
||||
]
|
||||
|
||||
Reference in new issue
Block a user