From 0217588d136c813d529a5f0bb8e51527977e8458 Mon Sep 17 00:00:00 2001 From: Pekka Enberg Date: Sat, 1 Nov 2025 11:42:35 +0200 Subject: [PATCH] Make mimalloc dependency optional --- bindings/rust/Cargo.toml | 5 +++-- bindings/rust/src/lib.rs | 2 +- cli/Cargo.toml | 5 +++-- cli/main.rs | 2 +- 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/bindings/rust/Cargo.toml b/bindings/rust/Cargo.toml index fec34f698..d90bf5104 100644 --- a/bindings/rust/Cargo.toml +++ b/bindings/rust/Cargo.toml @@ -10,18 +10,19 @@ repository.workspace = true description = "Turso Rust API" [features] -default = ["experimental_indexes"] +default = ["experimental_indexes", "mimalloc"] conn_raw_api = ["turso_core/conn_raw_api"] experimental_indexes = [] antithesis = ["turso_core/antithesis"] tracing_release = ["turso_core/tracing_release"] +mimalloc = ["dep:mimalloc"] [dependencies] turso_core = { workspace = true, features = ["io_uring"] } thiserror = { workspace = true } tracing-subscriber.workspace = true tracing.workspace = true -mimalloc = { workspace = true } +mimalloc = { workspace = true, optional = true } [dev-dependencies] tempfile = { workspace = true } diff --git a/bindings/rust/src/lib.rs b/bindings/rust/src/lib.rs index 27a51dea1..3f998352b 100644 --- a/bindings/rust/src/lib.rs +++ b/bindings/rust/src/lib.rs @@ -32,7 +32,7 @@ //! # } //! ``` -#[cfg(all(not(target_family = "wasm"), not(miri)))] +#[cfg(all(feature = "mimalloc", not(target_family = "wasm"), not(miri)))] #[global_allocator] static GLOBAL: mimalloc::MiMalloc = mimalloc::MiMalloc; diff --git a/cli/Cargo.toml b/cli/Cargo.toml index 35f691042..0b832f732 100644 --- a/cli/Cargo.toml +++ b/cli/Cargo.toml @@ -49,12 +49,13 @@ serde_json = "1.0" termimad = "0.30" include_dir = "0.7" rand = "0.8" -mimalloc = { workspace = true } +mimalloc = { workspace = true, optional = true } [features] -default = ["io_uring"] +default = ["io_uring", "mimalloc"] io_uring = ["turso_core/io_uring"] tracing_release = ["turso_core/tracing_release"] +mimalloc = ["dep:mimalloc"] [build-dependencies] syntect = { git = "https://github.com/trishume/syntect.git", rev = "64644ffe064457265cbcee12a0c1baf9485ba6ee" } diff --git a/cli/main.rs b/cli/main.rs index a9a4eeb89..b32c4e9fc 100644 --- a/cli/main.rs +++ b/cli/main.rs @@ -16,7 +16,7 @@ use std::{ sync::{atomic::Ordering, LazyLock}, }; -#[cfg(all(not(target_family = "wasm"), not(miri)))] +#[cfg(all(feature = "mimalloc", not(target_family = "wasm"), not(miri)))] #[global_allocator] static GLOBAL: mimalloc::MiMalloc = mimalloc::MiMalloc;