Skip to content

Commit 9ad41eb

Browse files
committed
Setup global allocator in the correct crate
It worked before, but was roundabout
1 parent deed44a commit 9ad41eb

File tree

5 files changed

+6
-10
lines changed

5 files changed

+6
-10
lines changed

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/ra_prof/Cargo.toml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ doctest = false
1313
ra_arena = { path = "../ra_arena" }
1414
once_cell = "1.3.1"
1515
backtrace = { version = "0.3.44", optional = true }
16-
mimalloc = { version = "0.1.19", default-features = false, optional = true }
1716
cfg-if = "0.1.10"
1817
libc = "0.2.73"
1918

@@ -22,5 +21,4 @@ cpu_profiler = []
2221

2322
# Uncomment to enable for the whole crate graph
2423
# default = [ "backtrace" ]
25-
# default = [ "mimalloc" ]
2624
# default = [ "cpu_profiler" ]

crates/ra_prof/src/lib.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,6 @@ pub use crate::{
1313
memory_usage::{Bytes, MemoryUsage},
1414
};
1515

16-
#[cfg(all(feature = "mimalloc"))]
17-
#[global_allocator]
18-
static ALLOC: mimalloc::MiMalloc = mimalloc::MiMalloc;
19-
2016
/// Prints backtrace to stderr, useful for debugging.
2117
#[cfg(feature = "backtrace")]
2218
pub fn print_backtrace() {

crates/rust-analyzer/Cargo.toml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ serde = { version = "1.0.106", features = ["derive"] }
2929
serde_json = "1.0.48"
3030
threadpool = "1.7.1"
3131
rayon = "1.3.1"
32+
mimalloc = { version = "0.1.19", default-features = false, optional = true }
3233

3334
stdx = { path = "../stdx" }
3435

@@ -62,6 +63,3 @@ expect = { path = "../expect" }
6263
test_utils = { path = "../test_utils" }
6364
mbe = { path = "../ra_mbe", package = "ra_mbe" }
6465
tt = { path = "../ra_tt", package = "ra_tt" }
65-
66-
[features]
67-
mimalloc = [ "ra_prof/mimalloc" ]

crates/rust-analyzer/src/bin/main.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ use vfs::AbsPathBuf;
1616

1717
use crate::args::HelpPrinted;
1818

19+
#[cfg(all(feature = "mimalloc"))]
20+
#[global_allocator]
21+
static ALLOC: mimalloc::MiMalloc = mimalloc::MiMalloc;
22+
1923
fn main() -> Result<()> {
2024
setup_logging()?;
2125
let args = match args::Args::parse()? {

0 commit comments

Comments
 (0)