diff --git a/Cargo.lock b/Cargo.lock index 8b5220b8..e8b6d57e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1191,6 +1191,16 @@ dependencies = [ "windows-targets 0.52.6", ] +[[package]] +name = "libmimalloc-sys" +version = "0.1.39" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23aa6811d3bd4deb8a84dde645f943476d13b248d818edcf8ce0b2f37f036b44" +dependencies = [ + "cc", + "libc", +] + [[package]] name = "libredox" version = "0.1.3" @@ -1261,6 +1271,15 @@ dependencies = [ "libc", ] +[[package]] +name = "mimalloc" +version = "0.1.43" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68914350ae34959d83f732418d51e2427a794055d0b9529f48259ac07af65633" +dependencies = [ + "libmimalloc-sys", +] + [[package]] name = "minimal-lexical" version = "0.2.1" @@ -2307,6 +2326,7 @@ dependencies = [ "log", "log-panics", "memmap2", + "mimalloc", "native-dialog", "normpath", "ntest", diff --git a/Cargo.toml b/Cargo.toml index d91d4f58..479d4744 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -79,6 +79,7 @@ webview2-com = "0.33" windows = "0.58" cbindgen = "0.27" log-panics = "2.1.0" +mimalloc = { version = "0.1", features = ["secure"] } # default to small, optimized workspace release binaries [profile.release] diff --git a/src/bins/Cargo.toml b/src/bins/Cargo.toml index 5734bcfe..bc40956a 100644 --- a/src/bins/Cargo.toml +++ b/src/bins/Cargo.toml @@ -105,6 +105,7 @@ webview2-com = "0.33" libloading.workspace = true strsim.workspace = true same-file.workspace = true +mimalloc.workspace = true # filelocksmith.workspace = true [dev-dependencies] diff --git a/src/bins/src/setup.rs b/src/bins/src/setup.rs index 685eccaf..4c57b8e1 100644 --- a/src/bins/src/setup.rs +++ b/src/bins/src/setup.rs @@ -1,6 +1,11 @@ #![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] #![allow(dead_code)] +// https://github.com/rust-lang/rust/issues/92173 +use mimalloc::MiMalloc; +#[global_allocator] +static GLOBAL: MiMalloc = MiMalloc; + #[macro_use] extern crate log; diff --git a/src/bins/src/update.rs b/src/bins/src/update.rs index 5e531b3a..e12bd66a 100644 --- a/src/bins/src/update.rs +++ b/src/bins/src/update.rs @@ -1,6 +1,11 @@ #![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] #![allow(dead_code)] +// https://github.com/rust-lang/rust/issues/92173 +use mimalloc::MiMalloc; +#[global_allocator] +static GLOBAL: MiMalloc = MiMalloc; + #[macro_use] extern crate log;