Re-enable custom allocators (#2876)

This commit is contained in:
Charlie Marsh 2023-02-13 21:37:22 -05:00 committed by GitHub
parent 6d1adc85fc
commit 2bf7b35268
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 66 additions and 5 deletions

50
Cargo.lock generated
View file

@ -1539,6 +1539,16 @@ dependencies = [
"syn", "syn",
] ]
[[package]]
name = "libmimalloc-sys"
version = "0.1.30"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dd8c7cbf8b89019683667e347572e6d55a7df7ea36b0c4ce69961b0cde67b174"
dependencies = [
"cc",
"libc",
]
[[package]] [[package]]
name = "link-cplusplus" name = "link-cplusplus"
version = "1.0.8" version = "1.0.8"
@ -1645,6 +1655,15 @@ dependencies = [
"autocfg", "autocfg",
] ]
[[package]]
name = "mimalloc"
version = "0.1.34"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9dcb174b18635f7561a0c6c9fc2ce57218ac7523cf72c50af80e2d79ab8f3ba1"
dependencies = [
"libmimalloc-sys",
]
[[package]] [[package]]
name = "mime" name = "mime"
version = "0.3.16" version = "0.3.16"
@ -2497,6 +2516,7 @@ dependencies = [
"itertools", "itertools",
"log", "log",
"mdcat", "mdcat",
"mimalloc",
"notify", "notify",
"path-absolutize", "path-absolutize",
"pulldown-cmark", "pulldown-cmark",
@ -2511,6 +2531,7 @@ dependencies = [
"strum", "strum",
"syntect", "syntect",
"textwrap", "textwrap",
"tikv-jemallocator",
"ureq", "ureq",
"walkdir", "walkdir",
] ]
@ -3128,11 +3149,10 @@ dependencies = [
[[package]] [[package]]
name = "thread_local" name = "thread_local"
version = "1.1.7" version = "1.1.4"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3fdd6f064ccff2d6567adcb3873ca630700f00b5ad3f060c25b5dcfd9a4ce152" checksum = "5516c27b78311c50bf42c071425c560ac799b11c30b31f87e3081965fe5e0180"
dependencies = [ dependencies = [
"cfg-if",
"once_cell", "once_cell",
] ]
@ -3156,6 +3176,26 @@ dependencies = [
"weezl", "weezl",
] ]
[[package]]
name = "tikv-jemalloc-sys"
version = "0.5.3+5.3.0-patched"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a678df20055b43e57ef8cddde41cdfda9a3c1a060b67f4c5836dfb1d78543ba8"
dependencies = [
"cc",
"libc",
]
[[package]]
name = "tikv-jemallocator"
version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "20612db8a13a6c06d57ec83953694185a367e16945f66565e8028d2c0bd76979"
dependencies = [
"libc",
"tikv-jemalloc-sys",
]
[[package]] [[package]]
name = "time" name = "time"
version = "0.1.45" version = "0.1.45"
@ -3231,9 +3271,9 @@ dependencies = [
[[package]] [[package]]
name = "tokio-util" name = "tokio-util"
version = "0.7.7" version = "0.7.6"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5427d89453009325de0d8f342c9490009f76e999cb7672d77e46267448f7e6b2" checksum = "bc6a3b08b64e6dfad376fa2432c7b1f01522e37a623c3050bc95db2d3ff21583"
dependencies = [ dependencies = [
"bytes", "bytes",
"futures-core", "futures-core",

View file

@ -65,3 +65,9 @@ ureq = { version = "2.5.0", features = [] }
[package.metadata.maturin] [package.metadata.maturin]
name = "ruff" name = "ruff"
[target.'cfg(windows)'.dependencies]
mimalloc = "0.1.29"
[target.'cfg(all(not(windows), any(target_arch = "x86_64", target_arch = "aarch64", target_arch = "powerpc64")))'.dependencies]
tikv-jemallocator = "0.5.0"

View file

@ -24,6 +24,21 @@ mod iterators;
mod printer; mod printer;
mod resolve; mod resolve;
#[cfg(target_os = "windows")]
#[global_allocator]
static GLOBAL: mimalloc::MiMalloc = mimalloc::MiMalloc;
#[cfg(all(
not(target_os = "windows"),
any(
target_arch = "x86_64",
target_arch = "aarch64",
target_arch = "powerpc64"
)
))]
#[global_allocator]
static GLOBAL: tikv_jemallocator::Jemalloc = tikv_jemallocator::Jemalloc;
enum ExitStatus { enum ExitStatus {
/// Linting was successful and there were no linting errors. /// Linting was successful and there were no linting errors.
Success, Success,