From bb1c63ebbcc6983992c8c771684aec8f2dfd1528 Mon Sep 17 00:00:00 2001 From: Austin Seipp Date: Wed, 1 Nov 2023 22:48:42 -0500 Subject: [PATCH] cli: use mimalloc from `jj-cbits` as the default memory allocator Signed-off-by: Austin Seipp Change-Id: I522b80f0fcfe3173c1412cdd9f49d127 --- Cargo.lock | 1 + cli/Cargo.toml | 1 + cli/src/main.rs | 4 ++++ 3 files changed, 6 insertions(+) diff --git a/Cargo.lock b/Cargo.lock index 606e44efc92..deaa9449d06 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1664,6 +1664,7 @@ dependencies = [ "indexmap", "insta", "itertools 0.12.1", + "jj-cbits", "jj-cli", "jj-lib", "libc", diff --git a/cli/Cargo.toml b/cli/Cargo.toml index cb0e83e455d..05f37c83b5c 100644 --- a/cli/Cargo.toml +++ b/cli/Cargo.toml @@ -51,6 +51,7 @@ gix = { workspace = true } hex = { workspace = true } indexmap = { workspace = true } itertools = { workspace = true } +jj-cbits = { workspace = true } jj-lib = { workspace = true } maplit = { workspace = true } minus = { workspace = true } diff --git a/cli/src/main.rs b/cli/src/main.rs index 8b2b2943d8c..38ea1a6870d 100644 --- a/cli/src/main.rs +++ b/cli/src/main.rs @@ -12,8 +12,12 @@ // See the License for the specific language governing permissions and // limitations under the License. +use jj_cbits::mimalloc::MiMalloc; use jj_cli::cli_util::CliRunner; +#[global_allocator] +static ALLOC: MiMalloc = MiMalloc; + fn main() -> std::process::ExitCode { CliRunner::init().version(env!("JJ_VERSION")).run() }