diff --git a/Cargo.lock b/Cargo.lock index f841529b1f..a9e530115c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3035,6 +3035,15 @@ version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "33a33a362ce288760ec6a508b94caaec573ae7d3bbbd91b87aa0bad4456839db" +[[package]] +name = "libmimalloc-sys" +version = "0.1.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "11ca136052550448f55df7898c6dbe651c6b574fe38a0d9ea687a9f8088a2e2c" +dependencies = [ + "cc", +] + [[package]] name = "libsqlite3-sys" version = "0.20.1" @@ -3278,6 +3287,15 @@ dependencies = [ "objc", ] +[[package]] +name = "mimalloc" +version = "0.1.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2f64ad83c969af2e732e907564deb0d0ed393cec4af80776f77dd77a1a427698" +dependencies = [ + "libmimalloc-sys", +] + [[package]] name = "minifb" version = "0.22.0" @@ -6658,6 +6676,7 @@ dependencies = [ "clap 3.1.8", "crossterm 0.23.2", "lazy_static", + "mimalloc", "num_cpus", "ron 0.7.0", "serde", @@ -6711,6 +6730,7 @@ dependencies = [ "itertools", "keyboard-keynames", "lazy_static", + "mimalloc", "mumble-link", "native-dialog", "num 0.4.0", diff --git a/server-cli/Cargo.toml b/server-cli/Cargo.toml index dfb40506d7..3bdc9f0b65 100644 --- a/server-cli/Cargo.toml +++ b/server-cli/Cargo.toml @@ -43,6 +43,9 @@ tracing = { version = "0.1", default-features = false } ron = {version = "0.7", default-features = false} serde = {version = "1.0", features = [ "rc", "derive" ]} +[target.'cfg(windows)'.dependencies] +mimalloc = "0.1.29" + [dependencies.tui] git = "https://github.com/fdehau/tui-rs.git" branch="paragraph-scroll" diff --git a/server-cli/src/main.rs b/server-cli/src/main.rs index 8d1fb66349..e88c6d7572 100644 --- a/server-cli/src/main.rs +++ b/server-cli/src/main.rs @@ -2,6 +2,10 @@ #![deny(clippy::clone_on_ref_ptr)] #![feature(bool_to_option)] +#[cfg(target_os = "windows")] +#[global_allocator] +static GLOBAL: mimalloc::MiMalloc = mimalloc::MiMalloc; + /// `server-cli` interface commands not to be confused with the commands sent /// from the client to the server mod cli; diff --git a/voxygen/Cargo.toml b/voxygen/Cargo.toml index 070cf9c1d6..b86d69f315 100644 --- a/voxygen/Cargo.toml +++ b/voxygen/Cargo.toml @@ -136,6 +136,9 @@ dispatch = "0.1.4" [target.'cfg(windows)'.build-dependencies] winres = "0.1" +[target.'cfg(windows)'.dependencies] +mimalloc = "0.1.29" + # Mumble [target.'cfg(not(target_os="macos"))'.dependencies] mumble-link = "0.1.0" diff --git a/voxygen/src/main.rs b/voxygen/src/main.rs index f7e57e9a9b..9203cdbac1 100644 --- a/voxygen/src/main.rs +++ b/voxygen/src/main.rs @@ -2,6 +2,10 @@ #![feature(bool_to_option)] #![recursion_limit = "2048"] +#[cfg(all(target_os = "windows", not(feature = "tracy-memory")))] +#[global_allocator] +static GLOBAL: mimalloc::MiMalloc = mimalloc::MiMalloc; + // Allow profiling allocations with Tracy #[cfg_attr(feature = "tracy-memory", global_allocator)] #[cfg(feature = "tracy-memory")]