Skip to content

Commit

Permalink
feat: use je for non-linux
Browse files Browse the repository at this point in the history
  • Loading branch information
h-a-n-a committed Nov 1, 2024
1 parent bcba230 commit 6e16de2
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 6 deletions.
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.

6 changes: 3 additions & 3 deletions crates/rspack_allocator/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ repository = "https://github.com/web-infra-dev/rspack"
version = "0.1.0"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[target.'cfg(target_os = "linux")'.dependencies]
[target.'cfg(any(target_os = "linux", target_env = "msvc"))'.dependencies]
# Turned on `local_dynamic_tls` to avoid issue: https://github.com/microsoft/mimalloc/issues/147
mimalloc = { workspace = true, features = ["local_dynamic_tls"] }

[target.'cfg(not(target_os = "linux"))'.dependencies]
mimalloc = { workspace = true }
[target.'cfg(not(any(target_os = "linux", target_env = "msvc")))'.dependencies]
tikv-jemallocator = "0.6"
9 changes: 6 additions & 3 deletions crates/rspack_allocator/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
// use mimalloc::MiMalloc;
#[cfg(not(any(target_os = "linux", target_env = "msvc")))]
#[global_allocator]
static GLOBAL: tikv_jemallocator::Jemalloc = tikv_jemallocator::Jemalloc;

// #[global_allocator]
// static GLOBAL: MiMalloc = MiMalloc;
#[cfg(any(target_os = "linux", target_env = "msvc"))]
#[global_allocator]
static GLOBAL: mimalloc::MiMalloc = mimalloc::MiMalloc;

0 comments on commit 6e16de2

Please sign in to comment.