From c4adea1ef1030294e9b5a1d8013a4fc1f81a5000 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 579ff91819..e035d1ced5 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1621,6 +1621,7 @@ dependencies = [ "indexmap", "insta", "itertools 0.11.0", + "jj-cbits", "jj-cli", "jj-lib", "libc", diff --git a/cli/Cargo.toml b/cli/Cargo.toml index b5de30e7e1..d84db2cd12 100644 --- a/cli/Cargo.toml +++ b/cli/Cargo.toml @@ -45,6 +45,7 @@ gix = { workspace = true } hex = { workspace = true } indexmap = { workspace = true } itertools = { workspace = true } +jj-cbits = { workspace = true } jj-lib = { workspace = true } maplit = { workspace = true } once_cell = { workspace = true } diff --git a/cli/src/main.rs b/cli/src/main.rs index 8b2b2943d8..38ea1a6870 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() }