From 42aa2ff5ba702671e830a1d6ec468620c751e135 Mon Sep 17 00:00:00 2001 From: Darren Schroeder <343840+fdncred@users.noreply.github.com> Date: Sat, 15 Mar 2025 09:32:55 -0500 Subject: [PATCH] remove mimalloc allocator (#15317) # Description This PR removes the mimalloc allocator due to run-away memory leaks recently found. closes #15311 # User-Facing Changes # Tests + Formatting # After Submitting --- Cargo.lock | 21 ------------------- Cargo.toml | 3 --- crates/nu-cmd-lang/Cargo.toml | 1 - .../nu-cmd-lang/src/core_commands/version.rs | 6 +----- crates/nu_plugin_polars/Cargo.toml | 1 - crates/nu_plugin_polars/src/main.rs | 3 --- src/main.rs | 4 ---- 7 files changed, 1 insertion(+), 38 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index b875372064..f9244630e4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2951,16 +2951,6 @@ version = "0.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8355be11b20d696c8f18f6cc018c4e372165b1fa8126cef092399c9951984ffa" -[[package]] -name = "libmimalloc-sys" -version = "0.1.39" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23aa6811d3bd4deb8a84dde645f943476d13b248d818edcf8ce0b2f37f036b44" -dependencies = [ - "cc", - "libc", -] - [[package]] name = "libproc" version = "0.14.10" @@ -3256,15 +3246,6 @@ dependencies = [ "syn 2.0.90", ] -[[package]] -name = "mimalloc" -version = "0.1.43" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68914350ae34959d83f732418d51e2427a794055d0b9529f48259ac07af65633" -dependencies = [ - "libmimalloc-sys", -] - [[package]] name = "mime" version = "0.3.17" @@ -3475,7 +3456,6 @@ dependencies = [ "fancy-regex", "log", "miette", - "mimalloc", "multipart-rs", "nix 0.29.0", "nu-cli", @@ -4132,7 +4112,6 @@ dependencies = [ "hashbrown 0.15.2", "indexmap", "log", - "mimalloc", "nu-cmd-lang", "nu-command", "nu-engine", diff --git a/Cargo.toml b/Cargo.toml index a237777e22..316c825b63 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -220,7 +220,6 @@ ctrlc = { workspace = true } dirs = { workspace = true } log = { workspace = true } miette = { workspace = true, features = ["fancy-no-backtrace", "fancy"] } -mimalloc = { version = "0.1.42", default-features = false, optional = true } multipart-rs = { workspace = true } serde_json = { workspace = true } simplelog = "0.12" @@ -274,7 +273,6 @@ default = [ "plugin", "trash-support", "sqlite", - "mimalloc", ] stable = ["default"] # NOTE: individual features are also passed to `nu-cmd-lang` that uses them to generate the feature matrix in the `version` command @@ -283,7 +281,6 @@ stable = ["default"] # otherwise the system version will be used. Not enabled by default because it takes a while to build static-link-openssl = ["dep:openssl", "nu-cmd-lang/static-link-openssl"] -mimalloc = ["nu-cmd-lang/mimalloc", "dep:mimalloc"] # Optional system clipboard support in `reedline`, this behavior has problematic compatibility with some systems. # Missing X server/ Wayland can cause issues system-clipboard = [ diff --git a/crates/nu-cmd-lang/Cargo.toml b/crates/nu-cmd-lang/Cargo.toml index 2cc86bd782..e505a1c853 100644 --- a/crates/nu-cmd-lang/Cargo.toml +++ b/crates/nu-cmd-lang/Cargo.toml @@ -42,7 +42,6 @@ plugin = [ "os", ] -mimalloc = [] trash-support = [] sqlite = [] static-link-openssl = [] diff --git a/crates/nu-cmd-lang/src/core_commands/version.rs b/crates/nu-cmd-lang/src/core_commands/version.rs index 9ebc43dee2..5ea4cfb4be 100644 --- a/crates/nu-cmd-lang/src/core_commands/version.rs +++ b/crates/nu-cmd-lang/src/core_commands/version.rs @@ -161,11 +161,7 @@ fn push_version_numbers(record: &mut Record, head: Span) { } fn global_allocator() -> &'static str { - if cfg!(feature = "mimalloc") { - "mimalloc" - } else { - "standard" - } + "standard" } fn features_enabled() -> Vec { diff --git a/crates/nu_plugin_polars/Cargo.toml b/crates/nu_plugin_polars/Cargo.toml index 1b91d0d760..d88c1c161b 100644 --- a/crates/nu_plugin_polars/Cargo.toml +++ b/crates/nu_plugin_polars/Cargo.toml @@ -27,7 +27,6 @@ chrono = { workspace = true, features = ["std", "unstable-locales"], default-fea chrono-tz = "0.10" fancy-regex = { workspace = true } indexmap = { version = "2.7" } -mimalloc = { version = "0.1.42" } num = {version = "0.4"} serde = { version = "1.0", features = ["derive"] } sqlparser = { version = "0.53"} diff --git a/crates/nu_plugin_polars/src/main.rs b/crates/nu_plugin_polars/src/main.rs index 3f880a10e4..850d5abf38 100644 --- a/crates/nu_plugin_polars/src/main.rs +++ b/crates/nu_plugin_polars/src/main.rs @@ -1,9 +1,6 @@ use nu_plugin::{serve_plugin, MsgPackSerializer}; use nu_plugin_polars::PolarsPlugin; -#[global_allocator] -static GLOBAL: mimalloc::MiMalloc = mimalloc::MiMalloc; - fn main() { env_logger::init(); diff --git a/src/main.rs b/src/main.rs index 1c9a49f3b4..f514eb47d0 100644 --- a/src/main.rs +++ b/src/main.rs @@ -9,10 +9,6 @@ mod signals; mod terminal; mod test_bins; -#[cfg(feature = "mimalloc")] -#[global_allocator] -static GLOBAL: mimalloc::MiMalloc = mimalloc::MiMalloc; - use crate::{ command::parse_commandline_args, config_files::set_config_path,