fix: add more allocator choices

This commit is contained in:
monosans
2025-09-30 14:40:44 +03:00
parent 704a7dfe15
commit d3f64742df
5 changed files with 48 additions and 15 deletions
+9 -5
View File
@@ -246,9 +246,9 @@ jobs:
env:
RUSTFLAGS: ""
- if: ${{ matrix.cross }}
run: cross +beta build --features mimalloc,tui --release --target '${{ matrix.target }}' --locked
run: cross +beta build --features mimalloc_v3,tui --release --target '${{ matrix.target }}' --locked
- if: ${{ !matrix.cross }}
run: cargo +beta build --features mimalloc,tui --release --target '${{ matrix.target }}' --locked
run: cargo +beta build --features mimalloc_v3,tui --release --target '${{ matrix.target }}' --locked
- run: mkdir dist
- run: echo -n '${{ github.sha }}' > dist/commit-sha.txt
shell: bash
@@ -410,7 +410,7 @@ jobs:
target: ${{ matrix.target }}
components: clippy
cache-key: x86_64-unknown-linux-gnu
- run: cargo +beta clippy --all-targets ${{ matrix.features }}
- run: cargo +beta clippy ${{ matrix.features }}
pre-commit:
runs-on: ubuntu-24.04
steps:
@@ -437,6 +437,11 @@ jobs:
- run: cargo +nightly fmt --check
udeps:
runs-on: ubuntu-24.04
strategy:
matrix:
features:
- ""
- "--features tui"
steps:
- uses: actions/checkout@v5
with:
@@ -446,5 +451,4 @@ jobs:
toolchain: nightly
cache-key: x86_64-unknown-linux-gnu
- run: cargo +nightly install --locked cargo-udeps
- run: cargo +nightly udeps
- run: cargo +nightly udeps --features mimalloc,tui
- run: cargo +nightly udeps ${{ matrix.features }}
Generated
+21
View File
@@ -1459,6 +1459,7 @@ dependencies = [
"rlimit",
"serde",
"serde_json",
"tikv-jemallocator",
"tokio",
"tokio-util",
"toml",
@@ -2124,6 +2125,26 @@ dependencies = [
"cfg-if",
]
[[package]]
name = "tikv-jemalloc-sys"
version = "0.6.0+5.3.0-1-ge13ca993e8ccb9ba9847cc330696e02839f328f7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cd3c60906412afa9c2b5b5a48ca6a5abe5736aec9eb48ad05037a677e52e4e2d"
dependencies = [
"cc",
"libc",
]
[[package]]
name = "tikv-jemallocator"
version = "0.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4cec5ff18518d81584f477e9bfdf957f5bb0979b0bac3af4ca30b5b3ae2d2865"
dependencies = [
"libc",
"tikv-jemalloc-sys",
]
[[package]]
name = "tinystr"
version = "0.8.1"
+8 -2
View File
@@ -55,11 +55,17 @@ tui-logger = { version = "=0.17.4", features = [
url = "=2.5.7"
[target.'cfg(all(any(target_arch = "aarch64", target_arch = "x86_64"), any(target_os = "linux", target_os = "macos", target_os = "windows")))'.dependencies]
mimalloc = { version = "=0.1.48", optional = true, features = ["v3"] }
mimalloc_v2 = { package = "mimalloc", version = "=0.1.48", optional = true }
mimalloc_v3 = { package = "mimalloc", version = "=0.1.48", optional = true, features = [
"v3",
] }
tikv-jemallocator = { version = "0.6.0", optional = true }
[features]
dhat = ["dep:dhat"]
mimalloc = ["dep:mimalloc"]
jemalloc = ["dep:tikv-jemallocator"]
mimalloc_v2 = ["dep:mimalloc_v2"]
mimalloc_v3 = ["dep:mimalloc_v3"]
tui = ["dep:crossterm", "dep:futures", "dep:ratatui", "dep:tui-logger"]
[profile.release]
+1 -1
View File
@@ -9,7 +9,7 @@ RUN --mount=source=src,target=src \
--mount=source=Cargo.lock,target=Cargo.lock \
--mount=type=cache,target=/app/target,sharing=locked \
--mount=type=cache,target=/usr/local/cargo/registry,sharing=locked \
cargo build --features mimalloc --release --locked \
cargo build --features mimalloc_v3 --release --locked \
&& cp target/release/proxy-scraper-checker .
+9 -7
View File
@@ -47,12 +47,6 @@
clippy::unwrap_used
)]
#[cfg(all(feature = "dhat", feature = "mimalloc"))]
compile_error!(
"Features 'dhat-heap' and 'mimalloc' are mutually exclusive. Enable only \
one."
);
mod checker;
mod config;
#[cfg(feature = "tui")]
@@ -80,7 +74,15 @@ use tracing_subscriber::{
static GLOBAL: dhat::Alloc = dhat::Alloc;
#[cfg(all(
feature = "mimalloc",
feature = "jemalloc",
any(target_arch = "aarch64", target_arch = "x86_64"),
any(target_os = "linux", target_os = "macos", target_os = "windows"),
))]
#[global_allocator]
static GLOBAL: tikv_jemallocator::Jemalloc = tikv_jemallocator::Jemalloc;
#[cfg(all(
any(feature = "mimalloc_v2", feature = "mimalloc_v3"),
any(target_arch = "aarch64", target_arch = "x86_64"),
any(target_os = "linux", target_os = "macos", target_os = "windows"),
))]