From fe724585ae01abb2f83cdf912b181d562a916bcc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fe=CC=81lix=20Saparelli?= Date: Tue, 5 Jul 2022 23:10:57 +1200 Subject: [PATCH] Use mimalloc on windows --- Cargo.toml | 3 +++ src/main.rs | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/Cargo.toml b/Cargo.toml index a4fe8f59..09282d9c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -68,6 +68,9 @@ zstd = { version = "0.10.0", features = ["bindgen", "zstdmt"], default-features [target.'cfg(any(target_os = "macos", target_os = "windows"))'.dependencies] guess_host_triple = "0.1.3" +[target.'cfg(windows)'.dependencies] +mimalloc = "0.1.29" + [dev-dependencies] env_logger = "0.9.0" diff --git a/src/main.rs b/src/main.rs index 506cc478..7a02617e 100644 --- a/src/main.rs +++ b/src/main.rs @@ -25,6 +25,10 @@ use cargo_binstall::{ *, }; +#[cfg(windows)] +#[global_allocator] +static GLOBAL: mimalloc::MiMalloc = mimalloc::MiMalloc; + #[derive(Debug, Parser)] #[clap(version, about = "Install a Rust binary... from binaries!")] struct Options {