diff --git a/crates/router/Cargo.toml b/crates/router/Cargo.toml index e199f62af4..70ae5edc67 100644 --- a/crates/router/Cargo.toml +++ b/crates/router/Cargo.toml @@ -45,6 +45,7 @@ http = "0.2.8" josekit = "0.8.1" literally = "0.1.3" maud = { version = "0.24", features = ["actix-web"] } +mimalloc = { version = "0.1", optional = true } mime = "0.3.16" nanoid = "0.4.0" once_cell = "1.16.0" diff --git a/crates/router/src/lib.rs b/crates/router/src/lib.rs index 871fc621c2..6e87de86e2 100644 --- a/crates/router/src/lib.rs +++ b/crates/router/src/lib.rs @@ -50,6 +50,10 @@ use crate::{ core::errors::{self, BachResult}, }; +#[cfg(feature = "mimalloc")] +#[global_allocator] +static ALLOC: mimalloc::MiMalloc = mimalloc::MiMalloc; + /// Header Constants pub mod headers { pub const X_API_KEY: &str = "X-API-KEY";