From eaba46994a54005951a7a09c3ec0f5524cae4ba8 Mon Sep 17 00:00:00 2001 From: 2ndDerivative Date: Tue, 12 Aug 2025 17:34:26 +0200 Subject: [PATCH] only use jemalloc with MSVC --- Cargo.toml | 4 +++- src/lib.rs | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 3cac0f3fb54..17e080f59b1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -125,7 +125,6 @@ spdx = "=0.10.9" tar = "=0.4.44" tempfile = "=3.20.0" thiserror = "=2.0.12" -tikv-jemallocator = { version = "=0.6.0", features = ['unprefixed_malloc_on_supported_platforms', 'profiling'] } tokio = { version = "=1.47.1", features = ["net", "signal", "io-std", "io-util", "rt-multi-thread", "macros", "process"]} tokio-postgres = "=0.7.13" tokio-util = "=0.7.16" @@ -139,6 +138,9 @@ url = "=2.5.4" utoipa = { version = "=5.4.0", features = ["chrono"] } utoipa-axum = "=0.2.0" +[target.'cfg(not(target_env = "msvc"))'.dependencies] +tikv-jemallocator = { version = "=0.6.0", features = ['unprefixed_malloc_on_supported_platforms', 'profiling'] } + [dev-dependencies] bytes = "=1.10.1" crates_io_docs_rs = { path = "crates/crates_io_docs_rs", features = ["mock"] } diff --git a/src/lib.rs b/src/lib.rs index 7428861b43a..9f4515944e1 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -10,8 +10,10 @@ use std::sync::Arc; use crate::app::AppState; use crate::router::build_axum_router; +#[cfg(not(target_env = "msvc"))] use tikv_jemallocator::Jemalloc; +#[cfg(not(target_env = "msvc"))] #[global_allocator] static ALLOC: Jemalloc = Jemalloc;