From ddaae19a1690cb810e6336aff8a7dc4d79fab784 Mon Sep 17 00:00:00 2001 From: Caelan Sayler Date: Thu, 19 Dec 2024 14:34:45 +0000 Subject: [PATCH] switch mimalloc to jemalloc --- Cargo.lock | 41 +++++++++++++++++++++-------------------- Cargo.toml | 2 +- src/bins/Cargo.toml | 2 +- src/bins/src/setup.rs | 5 ----- src/bins/src/update.rs | 6 ++++-- 5 files changed, 27 insertions(+), 29 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index e8b6d57e..241ead5f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1191,16 +1191,6 @@ 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" @@ -1271,15 +1261,6 @@ 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" @@ -2071,6 +2052,26 @@ dependencies = [ "syn 2.0.90", ] +[[package]] +name = "tikv-jemalloc-sys" +version = "0.6.0+5.3.0-1-ge13ca993e8ccb9ba9847cc330696e02839f328f7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd3c60906412afa9c2b5b5a48ca6a5abe5736aec9eb48ad05037a677e52e4e2d" +dependencies = [ + "cc", + "libc", +] + +[[package]] +name = "tikv-jemallocator" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4cec5ff18518d81584f477e9bfdf957f5bb0979b0bac3af4ca30b5b3ae2d2865" +dependencies = [ + "libc", + "tikv-jemalloc-sys", +] + [[package]] name = "time" version = "0.1.45" @@ -2326,7 +2327,6 @@ dependencies = [ "log", "log-panics", "memmap2", - "mimalloc", "native-dialog", "normpath", "ntest", @@ -2344,6 +2344,7 @@ dependencies = [ "strsim", "strum", "tempfile", + "tikv-jemallocator", "time 0.3.37", "velopack", "wait-timeout", diff --git a/Cargo.toml b/Cargo.toml index 479d4744..50bea6dc 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -79,7 +79,7 @@ webview2-com = "0.33" windows = "0.58" cbindgen = "0.27" log-panics = "2.1.0" -mimalloc = { version = "0.1", features = ["secure"] } +tikv-jemallocator = "0.6" # default to small, optimized workspace release binaries [profile.release] diff --git a/src/bins/Cargo.toml b/src/bins/Cargo.toml index bc40956a..7adfde9f 100644 --- a/src/bins/Cargo.toml +++ b/src/bins/Cargo.toml @@ -105,7 +105,7 @@ webview2-com = "0.33" libloading.workspace = true strsim.workspace = true same-file.workspace = true -mimalloc.workspace = true +tikv-jemallocator.workspace = true # filelocksmith.workspace = true [dev-dependencies] diff --git a/src/bins/src/setup.rs b/src/bins/src/setup.rs index 4c57b8e1..685eccaf 100644 --- a/src/bins/src/setup.rs +++ b/src/bins/src/setup.rs @@ -1,11 +1,6 @@ #![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 e12bd66a..81866784 100644 --- a/src/bins/src/update.rs +++ b/src/bins/src/update.rs @@ -2,9 +2,11 @@ #![allow(dead_code)] // https://github.com/rust-lang/rust/issues/92173 -use mimalloc::MiMalloc; +#[cfg(target_os = "macos")] +use tikv_jemallocator::Jemalloc; +#[cfg(target_os = "macos")] #[global_allocator] -static GLOBAL: MiMalloc = MiMalloc; +static GLOBAL: Jemalloc = Jemalloc; #[macro_use] extern crate log;