+
Skip to content
This repository was archived by the owner on Aug 31, 2023. It is now read-only.

feat: replace the system allocator with mimalloc on Windows #2900

Merged
merged 1 commit into from
Jul 19, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions crates/rome_cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,6 @@ hdrhistogram = { version = "7.5.0", default-features = false }
crossbeam = "0.8.1"
thiserror = "1.0.30"
rayon = "1.5.1"

[target.'cfg(target_os = "windows")'.dependencies]
mimalloc = "0.1.29"
4 changes: 4 additions & 0 deletions crates/rome_cli/src/bin/rome.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
use rome_cli::{run_cli, setup_panic_handler, CliSession, Termination};

#[cfg(target_os = "windows")]
#[global_allocator]
static GLOBAL: mimalloc::MiMalloc = mimalloc::MiMalloc;

///
/// To run this example, run:
///
Expand Down
3 changes: 3 additions & 0 deletions crates/rome_lsp/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,8 @@ tracing-subscriber = "0.3.5"
parking_lot = "0.12.0"
futures = "0.3"

[target.'cfg(target_os = "windows")'.dependencies]
mimalloc = "0.1.29"

[dev-dependencies]
tower = { version = "0.4.12", features = ["timeout"] }
4 changes: 4 additions & 0 deletions crates/rome_lsp/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ use tracing_tree::HierarchicalLayer;

use rome_lsp::server::run_server;

#[cfg(target_os = "windows")]
#[global_allocator]
static GLOBAL: mimalloc::MiMalloc = mimalloc::MiMalloc;

#[tokio::main]
async fn main() {
let stdin = tokio::io::stdin();
Expand Down
3 changes: 3 additions & 0 deletions xtask/bench/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ url = "2.2.2"
itertools = "0.10.3"
ansi_rgb = "0.2.0"

[target.'cfg(target_os = "windows")'.dependencies]
mimalloc = "0.1.29"

# dhat-on
dhat = { version = "0.2.4", optional = true }
humansize = {version = "1.1.1", optional = true }
Expand Down
4 changes: 4 additions & 0 deletions xtask/bench/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ use dhat::DhatAlloc;
#[global_allocator]
static ALLOCATOR: DhatAlloc = DhatAlloc;

#[cfg(all(target_os = "windows", not(feature = "dhat-on")))]
#[global_allocator]
static GLOBAL: mimalloc::MiMalloc = mimalloc::MiMalloc;

fn main() -> Result<(), pico_args::Error> {
#[cfg(feature = "dhat-on")]
let _dhat = dhat::Dhat::start_heap_profiling();
Expand Down
点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载