--- a/cmds/jrsonnet/Cargo.toml +++ b/cmds/jrsonnet/Cargo.toml @@ -8,12 +8,17 @@ # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html +[features] +default = [] +# Use mimalloc as allocator +mimalloc = [] + [dependencies] jrsonnet-evaluator = { path = "../../crates/jrsonnet-evaluator", version = "1.0.0" } jrsonnet-parser = { path = "../../crates/jrsonnet-parser", version = "1.0.0" } jrsonnet-cli = { path = "../../crates/jrsonnet-cli", version = "0.1.0" } # TODO: Fix mimalloc compile errors, and use them -mimallocator = "0.1.3" +mimallocator = { version = "0.1.3", optional = true } [dependencies.clap] git = "https://github.com/clap-rs/clap" --- a/cmds/jrsonnet/src/main.rs +++ b/cmds/jrsonnet/src/main.rs @@ -3,6 +3,7 @@ use jrsonnet_evaluator::{error::Result, EvaluationState}; use std::{path::PathBuf, rc::Rc}; +#[cfg(feature = "mimalloc")] #[global_allocator] static GLOBAL: mimallocator::Mimalloc = mimallocator::Mimalloc;