1
Fork 0

only use jemalloc on Unix

This commit is contained in:
Ralf Jung 2024-01-07 13:15:53 +01:00
parent b8209e2ef1
commit c4a11ea93e
2 changed files with 4 additions and 1 deletions

View file

@ -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']

View file

@ -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>.
@ -334,6 +335,7 @@ fn jemalloc_magic() {
}
fn main() {
#[cfg(unix)]
jemalloc_magic();
let early_dcx = EarlyDiagCtxt::new(ErrorOutputType::default());