Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

only use jemalloc on Linux and macOS #3261

Merged
merged 1 commit into from
Jan 8, 2024
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 3 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,9 @@ measureme = "10.0.0"
ctrlc = "3.2.5"

# Copied from `compiler/rustc/Cargo.toml`.
# But only for Unix, it fails on Windows.
[target.'cfg(unix)'.dependencies.jemalloc-sys]
# But only for some targets, it fails for others. Rustc configures this in its CI, but we can't
# easily use that since we support of-tree builds.
[target.'cfg(any(target_os = "linux", target_os = "macos"))'.dependencies.jemalloc-sys]
version = "0.5.0"
features = ['unprefixed_malloc_on_supported_platforms']

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

#[cfg(unix)]
#[cfg(any(target_os = "linux", target_os = "macos"))]
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 @@ -335,7 +335,7 @@ fn jemalloc_magic() {
}

fn main() {
#[cfg(unix)]
#[cfg(any(target_os = "linux", target_os = "macos"))]
jemalloc_magic();

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