Use mimalloc as default allocator (#7140)

From https://github.com/microsoft/mimalloc:
> In our benchmarks (see
[below](https://github.com/microsoft/mimalloc#performance)), mimalloc
outperforms other leading allocators (jemalloc, tcmalloc, Hoard, etc),
and often uses less memory. A nice property is that it does consistently
well over a wide range of benchmarks. There is also good huge OS page
support for larger server programs.


Release Notes:

- Changed default allocator to mimalloc.
This commit is contained in:
Ares Andrew 2024-02-01 01:50:37 +08:00 committed by GitHub
parent b7ced3943e
commit 59f77d316f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 25 additions and 0 deletions

20
Cargo.lock generated
View file

@ -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",

View file

@ -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"

View file

@ -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();