Skip to content

Commit

Permalink
only use jemalloc on Unix
Browse files Browse the repository at this point in the history
  • Loading branch information
RalfJung committed Jan 7, 2024
1 parent c26b5d6 commit f91e5b9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ measureme = "10.0.0"
ctrlc = "3.2.5"

# Copied from `compiler/rustc/Cargo.toml`.
[dependencies.jemalloc-sys]
# But only for Unix, it fails on Windows.
[target.'cfg(unix)'.dependencies.jemalloc-sys]
version = "0.5.0"
features = ['unprefixed_malloc_on_supported_platforms']

Expand Down
2 changes: 2 additions & 0 deletions src/bin/miri.rs
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,7 @@ fn parse_comma_list<T: FromStr>(input: &str) -> Result<Vec<T>, T::Err> {
input.split(',').map(str::parse::<T>).collect()
}

#[cfg(unix)]
fn jemalloc_magic() {
// These magic runes are copied from
// <https://github.com/rust-lang/rust/blob/e89bd9428f621545c979c0ec686addc6563a394e/compiler/rustc/src/main.rs#L39>.
Expand Down Expand Up @@ -334,6 +335,7 @@ fn jemalloc_magic() {
}

fn main() {
#[cfg(unix)]
jemalloc_magic();

let early_dcx = EarlyDiagCtxt::new(ErrorOutputType::default());
Expand Down

0 comments on commit f91e5b9

Please sign in to comment.