Make mimalloc dependency optional

This commit is contained in:
Pekka Enberg
2025-11-01 11:42:35 +02:00
parent 9336f1c213
commit 0217588d13
4 changed files with 8 additions and 6 deletions

View File

@@ -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 }

View File

@@ -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;

View File

@@ -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" }

View File

@@ -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;