diff --git a/Cargo.lock b/Cargo.lock index 3774dc4751..0a6d44fc35 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4093,6 +4093,16 @@ version = "0.2.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f7012b1bbb0719e1097c47611d3898568c546d597c2e74d66f6087edd5233ff4" +[[package]] +name = "libmimalloc-sys" +version = "0.1.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3979b5c37ece694f1f5e51e7ecc871fdb0f517ed04ee45f88d15d6d553cb9664" +dependencies = [ + "cc", + "libc", +] + [[package]] name = "libsqlite3-sys" version = "0.26.0" @@ -4422,6 +4432,15 @@ dependencies = [ "objc", ] +[[package]] +name = "mimalloc" +version = "0.1.39" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa01922b5ea280a911e323e4d2fd24b7fe5cc4042e0d2cda3c40775cdc4bdc9c" +dependencies = [ + "libmimalloc-sys", +] + [[package]] name = "mime" version = "0.3.17" @@ -10285,6 +10304,7 @@ dependencies = [ "log", "lsp", "menu", + "mimalloc", "node_runtime", "notifications", "num_cpus", diff --git a/crates/zed/Cargo.toml b/crates/zed/Cargo.toml index c27f963bd1..0b73a44919 100644 --- a/crates/zed/Cargo.toml +++ b/crates/zed/Cargo.toml @@ -66,6 +66,7 @@ libc = "0.2" log.workspace = true lsp = { path = "../lsp" } menu = { path = "../menu" } +mimalloc = "0.1" node_runtime = { path = "../node_runtime" } notifications = { path = "../notifications" } num_cpus = "1.13.0" diff --git a/crates/zed/src/main.rs b/crates/zed/src/main.rs index 3e5a1adb6f..97ee6d1c68 100644 --- a/crates/zed/src/main.rs +++ b/crates/zed/src/main.rs @@ -18,6 +18,7 @@ use language::LanguageRegistry; use log::LevelFilter; use assets::Assets; +use mimalloc::MiMalloc; use node_runtime::RealNodeRuntime; use parking_lot::Mutex; use release_channel::{parse_zed_link, AppCommitSha, ReleaseChannel, RELEASE_CHANNEL}; @@ -57,6 +58,9 @@ use zed::{ OpenRequest, }; +#[global_allocator] +static GLOBAL: MiMalloc = MiMalloc; + fn main() { menu::init(); zed_actions::init();