From 765b6aa2c5962ba84f9401a707399b14d0a387e2 Mon Sep 17 00:00:00 2001 From: Yue Ni Date: Sun, 23 Oct 2022 23:49:59 +0800 Subject: [PATCH] Switch from jemalloc to mimalloc to avoid https://github.com/tikv/jemallocator/issues/17 --- Cargo.lock | 57 +++++++++++++++++---------------------- Cargo.toml | 4 +-- lib/vrl/tests/Cargo.toml | 2 +- lib/vrl/tests/src/main.rs | 2 +- src/lib.rs | 4 +-- 5 files changed, 30 insertions(+), 39 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 218884e2682cc..577112911e118 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2879,12 +2879,6 @@ dependencies = [ "num", ] -[[package]] -name = "fs_extra" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2022715d62ab30faffd124d40b76f4134a550a87792276512b18d63272333394" - [[package]] name = "fsevent-sys" version = "4.1.0" @@ -4230,6 +4224,15 @@ version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "33a33a362ce288760ec6a508b94caaec573ae7d3bbbd91b87aa0bad4456839db" +[[package]] +name = "libmimalloc-sys" +version = "0.1.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8fc093ab289b0bfda3aa1bdfab9c9542be29c7ef385cfcbe77f8c9813588eb48" +dependencies = [ + "cc", +] + [[package]] name = "libz-sys" version = "1.1.6" @@ -4554,6 +4557,15 @@ dependencies = [ "sketches-ddsketch", ] +[[package]] +name = "mimalloc" +version = "0.1.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76ce6a4b40d3bff9eb3ce9881ca0737a85072f9f975886082640cd46a75cdb35" +dependencies = [ + "libmimalloc-sys", +] + [[package]] name = "mime" version = "0.3.16" @@ -6305,8 +6317,8 @@ dependencies = [ [[package]] name = "rdkafka" -version = "0.28.0" -source = "git+https://github.com/fede1024/rust-rdkafka?tag=v0.29.0#fe99e1fb18433debc5ba6ca811de983c535e1804" +version = "0.29.0" +source = "git+https://github.com/fede1024/rust-rdkafka?tag=v0.29.0#65520c820565f9882475cc29cd6d149940515324" dependencies = [ "futures-channel", "futures-util", @@ -6322,8 +6334,8 @@ dependencies = [ [[package]] name = "rdkafka-sys" -version = "4.2.0+1.8.2" -source = "git+https://github.com/fede1024/rust-rdkafka?tag=v0.29.0#fe99e1fb18433debc5ba6ca811de983c535e1804" +version = "4.3.0+1.9.2" +source = "git+https://github.com/fede1024/rust-rdkafka?tag=v0.29.0#65520c820565f9882475cc29cd6d149940515324" dependencies = [ "cmake", "libc", @@ -7773,27 +7785,6 @@ dependencies = [ "once_cell", ] -[[package]] -name = "tikv-jemalloc-sys" -version = "0.5.0+5.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aeab4310214fe0226df8bfeb893a291a58b19682e8a07e1e1d4483ad4200d315" -dependencies = [ - "cc", - "fs_extra", - "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]] name = "time" version = "0.3.14" @@ -8842,6 +8833,7 @@ dependencies = [ "md-5", "metrics", "metrics-tracing-context", + "mimalloc", "mlua", "mongodb", "nats", @@ -8896,7 +8888,6 @@ dependencies = [ "strip-ansi-escapes", "syslog", "tempfile", - "tikv-jemallocator", "tokio", "tokio-openssl", "tokio-postgres", @@ -9347,11 +9338,11 @@ dependencies = [ "enrichment", "glob", "lookup", + "mimalloc", "prettydiff", "regex", "serde", "serde_json", - "tikv-jemallocator", "tracing-subscriber 0.3.16", "value", "vector-common", diff --git a/Cargo.toml b/Cargo.toml index 04de25f49ee6e..78896dff5c24e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -300,7 +300,7 @@ socket2 = { version = "0.4.7", default-features = false } stream-cancel = { version = "0.8.1", default-features = false } strip-ansi-escapes = { version = "0.1.1", default-features = false } syslog = { version = "6.0.1", default-features = false, optional = true } -tikv-jemallocator = { version = "0.5.0", default-features = false, optional = true } +mimalloc = { version = "0.1.30", default-features = true, optional = true} tokio-postgres = { version = "0.7.7", default-features = false, features = ["runtime", "with-chrono-0_4"], optional = true } tokio-tungstenite = {version = "0.17.2", default-features = false, features = ["connect"], optional = true} toml = { version = "0.5.9", default-features = false } @@ -401,7 +401,7 @@ target-powerpc64le-unknown-linux-gnu = ["api", "api-client", "enrichment-tables" target-powerpc-unknown-linux-gnu = ["api", "api-client", "enrichment-tables", "rdkafka?/cmake_build", "sinks", "sources", "sources-dnstap", "transforms", "unix", "vrl-cli", "enterprise"] # Enables features that work only on systems providing `cfg(unix)` -unix = ["tikv-jemallocator"] +unix = ["mimalloc"] # Enables kubernetes dependencies and shared code. Kubernetes-related sources, # transforms and sinks should depend on this feature. diff --git a/lib/vrl/tests/Cargo.toml b/lib/vrl/tests/Cargo.toml index 8eedcee43fa03..b5d893011525c 100644 --- a/lib/vrl/tests/Cargo.toml +++ b/lib/vrl/tests/Cargo.toml @@ -26,7 +26,7 @@ serde_json = "1" tracing-subscriber = { version = "0.3.16", default-features = false, features = ["fmt"] } [target.'cfg(not(target_env = "msvc"))'.dependencies] -tikv-jemallocator = { version = "0.5.0" } +mimalloc = { version = "0.1.30" } [features] default = [] diff --git a/lib/vrl/tests/src/main.rs b/lib/vrl/tests/src/main.rs index dde991f5ac29a..ac999c031b9e3 100644 --- a/lib/vrl/tests/src/main.rs +++ b/lib/vrl/tests/src/main.rs @@ -23,7 +23,7 @@ use vrl_tests::{docs, Test}; #[cfg(not(target_env = "msvc"))] #[global_allocator] -static ALLOC: tikv_jemallocator::Jemalloc = tikv_jemallocator::Jemalloc; +static ALLOC: mimalloc::MiMalloc = mimalloc::MiMalloc; #[derive(Parser, Debug)] #[clap(name = "VRL Tests", about = "Vector Remap Language Tests")] diff --git a/src/lib.rs b/src/lib.rs index 94aed1fca000a..1661b65f9b0ab 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -22,9 +22,9 @@ extern crate tracing; #[macro_use] extern crate derivative; -#[cfg(feature = "tikv-jemallocator")] +#[cfg(feature = "mimalloc")] #[global_allocator] -static ALLOC: tikv_jemallocator::Jemalloc = tikv_jemallocator::Jemalloc; +static ALLOC: mimalloc::MiMalloc = mimalloc::MiMalloc; #[macro_use] #[allow(unreachable_pub)]