Use mimalloc memory allocator

This commit is contained in:
Caelan Sayler
2024-12-19 14:25:40 +00:00
committed by Caelan
parent 26f877f55d
commit ea5049347b
5 changed files with 32 additions and 0 deletions

20
Cargo.lock generated
View File

@@ -1191,6 +1191,16 @@ dependencies = [
"windows-targets 0.52.6", "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]] [[package]]
name = "libredox" name = "libredox"
version = "0.1.3" version = "0.1.3"
@@ -1261,6 +1271,15 @@ dependencies = [
"libc", "libc",
] ]
[[package]]
name = "mimalloc"
version = "0.1.43"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "68914350ae34959d83f732418d51e2427a794055d0b9529f48259ac07af65633"
dependencies = [
"libmimalloc-sys",
]
[[package]] [[package]]
name = "minimal-lexical" name = "minimal-lexical"
version = "0.2.1" version = "0.2.1"
@@ -2307,6 +2326,7 @@ dependencies = [
"log", "log",
"log-panics", "log-panics",
"memmap2", "memmap2",
"mimalloc",
"native-dialog", "native-dialog",
"normpath", "normpath",
"ntest", "ntest",

View File

@@ -79,6 +79,7 @@ webview2-com = "0.33"
windows = "0.58" windows = "0.58"
cbindgen = "0.27" cbindgen = "0.27"
log-panics = "2.1.0" log-panics = "2.1.0"
mimalloc = { version = "0.1", features = ["secure"] }
# default to small, optimized workspace release binaries # default to small, optimized workspace release binaries
[profile.release] [profile.release]

View File

@@ -105,6 +105,7 @@ webview2-com = "0.33"
libloading.workspace = true libloading.workspace = true
strsim.workspace = true strsim.workspace = true
same-file.workspace = true same-file.workspace = true
mimalloc.workspace = true
# filelocksmith.workspace = true # filelocksmith.workspace = true
[dev-dependencies] [dev-dependencies]

View File

@@ -1,6 +1,11 @@
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] #![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]
#![allow(dead_code)] #![allow(dead_code)]
// https://github.com/rust-lang/rust/issues/92173
use mimalloc::MiMalloc;
#[global_allocator]
static GLOBAL: MiMalloc = MiMalloc;
#[macro_use] #[macro_use]
extern crate log; extern crate log;

View File

@@ -1,6 +1,11 @@
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] #![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]
#![allow(dead_code)] #![allow(dead_code)]
// https://github.com/rust-lang/rust/issues/92173
use mimalloc::MiMalloc;
#[global_allocator]
static GLOBAL: MiMalloc = MiMalloc;
#[macro_use] #[macro_use]
extern crate log; extern crate log;