fix: support allocator override

This commit is contained in:
monosans
2026-05-03 16:36:31 +03:00
parent f2424321a9
commit d31632b3f7
8 changed files with 37 additions and 26 deletions
+2 -2
View File
@@ -24,9 +24,9 @@ fi
: > /work/alpine-results.tsv
if [ -n "$features" ]; then
cargo build --release --locked --features "$features"
cargo build --no-default-features --release --locked --features "$features"
else
cargo build --release --locked
cargo build --no-default-features --release --locked
fi
output="$(/usr/bin/time -v /work/target/release/proxy-scraper-checker 2>&1 >/dev/null)"
+1 -1
View File
@@ -30,7 +30,7 @@ if [[ -n "$features" ]]; then
feature_args=(--features "$features")
fi
cargo build --release --locked "${feature_args[@]}"
cargo build --no-default-features --release --locked "${feature_args[@]}"
exe="target/release/proxy-scraper-checker"
if [[ "$RUNNER_OS" == "Windows" ]]; then
+1 -1
View File
@@ -7,7 +7,7 @@ if ($allocator -ne "system") { $features += $allocator }
if ($tokioFeature) { $features += $tokioFeature }
$featuresString = $features -join ","
$args = @("build", "--release", "--locked")
$args = @("build", "--no-default-features", "--release", "--locked")
if ($featuresString) { $args += "--features"; $args += $featuresString }
Start-Process -FilePath "cargo" -ArgumentList $args -NoNewWindow -Wait
+7
View File
@@ -16,8 +16,11 @@ jobs:
allocator:
- system
- jemalloc
- jemalloc_override
- mimalloc_v2
- mimalloc_v2_override
- mimalloc_v3
- mimalloc_v3_override
tokio_multi_thread: [true, false]
platform:
- ubuntu-24.04-arm
@@ -56,8 +59,12 @@ jobs:
exclude:
- platform: windows-2025
allocator: jemalloc
- platform: windows-2025
allocator: jemalloc_override
- platform: windows-11-arm
allocator: jemalloc
- platform: windows-11-arm
allocator: jemalloc_override
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
Generated
+2 -2
View File
@@ -884,9 +884,9 @@ dependencies = [
[[package]]
name = "hickory-resolver"
version = "0.26.0"
version = "0.26.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a10bd64d950b4d38ca21e25c8ae230712e4955fb8290cfcb29a5e5dc6017e544"
checksum = "f0d58d28879ceecde6607729660c2667a081ccdc082e082675042793960f178c"
dependencies = [
"cfg-if",
"futures-util",
+14 -9
View File
@@ -20,7 +20,7 @@ foldhash = "=0.2.0"
futures = { version = "=0.3.32", default-features = false, features = [
"std",
], optional = true }
hickory-resolver = "=0.26.0"
hickory-resolver = "=0.26.1"
http = "=1.4.0"
httpdate = "=1.0.3"
ipnet = "=2.12.0"
@@ -31,6 +31,7 @@ log = { version = "=0.4.29", features = [
"std",
] }
maxminddb = { version = "=0.28.1", features = ["mmap"] }
mimalloc = { version = "=0.1.50", optional = true }
parking_lot = "=0.12.5"
rand = { version = "=0.10.1", default-features = false, features = [
"std",
@@ -57,6 +58,7 @@ smallvec = { version = "=1.15.1", features = [
"union",
], optional = true }
strum = { version = "=0.28.0", features = ["derive"], optional = true }
tikv-jemallocator = { version = "=0.6.1", optional = true }
tokio = { version = "=1.52.1", features = ["fs", "parking_lot", "signal"] }
tokio-util = "=0.7.18"
toml = { version = "=1.1.2", default-features = false, features = [
@@ -75,17 +77,20 @@ tui-logger = { version = "=0.18.2", features = [
], optional = true }
url = "=2.5.8"
[target.'cfg(all(any(target_arch = "aarch64", target_arch = "x86_64"), any(target_os = "linux", target_os = "macos")))'.dependencies]
tikv-jemallocator = { version = "=0.6.1", optional = true }
[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.50", optional = true }
[features]
# default = ["auto-allocator"]
__mimalloc = ["dep:mimalloc"]
auto-allocator = ["mimalloc_v3_override"]
dhat = ["dep:dhat"]
jemalloc = ["dep:tikv-jemallocator"]
mimalloc_v2 = ["dep:mimalloc", "mimalloc/v2"]
mimalloc_v3 = ["dep:mimalloc"]
jemalloc_override = [
"jemalloc",
"tikv-jemallocator/unprefixed_malloc_on_supported_platforms"
]
mimalloc_v2 = ["__mimalloc", "mimalloc/v2"]
mimalloc_v2_override = ["mimalloc_v2", "mimalloc/override"]
mimalloc_v3 = ["__mimalloc"]
mimalloc_v3_override = ["mimalloc_v3", "mimalloc/override"]
tokio-multi-thread = []
tui = [
"dep:crossterm",
+2 -2
View File
@@ -116,13 +116,13 @@ This tool makes thousands of concurrent network requests to test proxies, which
3. **Build release binary with TUI enabled**
```bash
cargo build --release --features tui
cargo build --features tui --release --locked
```
4. **Run with TUI**
```bash
cargo run --release --features tui
cargo run --features tui --release --locked
```
**Binary location**:
+8 -9
View File
@@ -73,18 +73,17 @@ use tracing_subscriber::{
#[global_allocator]
static GLOBAL: dhat::Alloc = dhat::Alloc;
#[cfg(all(
feature = "jemalloc",
any(target_arch = "aarch64", target_arch = "x86_64"),
any(target_os = "linux", target_os = "macos"),
))]
#[cfg(feature = "jemalloc")]
#[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"),
#[cfg(any(
all(
feature = "auto-allocator",
any(target_arch = "aarch64", target_arch = "x86_64"),
any(target_os = "linux", target_os = "macos", target_os = "windows"),
),
feature = "__mimalloc"
))]
#[global_allocator]
static GLOBAL: mimalloc::MiMalloc = mimalloc::MiMalloc;