diff --git a/Cargo.lock b/Cargo.lock index 1480ddd9a09..53386d53223 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3902,6 +3902,16 @@ 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 = "libp2p-identity" version = "0.2.9" @@ -4080,6 +4090,15 @@ dependencies = [ "syn 2.0.87", ] +[[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" @@ -4831,6 +4850,7 @@ dependencies = [ "indicatif", "indoc", "miette", + "mimalloc", "minicbor", "mockito", "nix 0.29.0", @@ -7291,6 +7311,7 @@ name = "stress-test" version = "0.1.0" dependencies = [ "clap", + "mimalloc", "ockam", "ockam_api", "ockam_core", diff --git a/NOTICE.md b/NOTICE.md index 96a239bbe2a..f8d7799ae99 100644 --- a/NOTICE.md +++ b/NOTICE.md @@ -304,6 +304,7 @@ This file contains attributions for any 3rd-party open source code used in this | libdbus-sys | Apache-2.0, MIT | https://crates.io/crates/libdbus-sys | | libloading | ISC | https://crates.io/crates/libloading | | libm | MIT, Apache-2.0 | https://crates.io/crates/libm | +| libmimalloc-sys | MIT | https://crates.io/crates/libmimalloc-sys | | libsqlite3-sys | MIT | https://crates.io/crates/libsqlite3-sys | | linked-hash-map | MIT, Apache-2.0 | https://crates.io/crates/linked-hash-map | | linux-raw-sys | Apache-2.0 WITH LLVM-exception, Apache-2.0, MIT | https://crates.io/crates/linux-raw-sys | @@ -320,6 +321,7 @@ This file contains attributions for any 3rd-party open source code used in this | memoffset | MIT | https://crates.io/crates/memoffset | | miette | Apache-2.0 | https://crates.io/crates/miette | | miette-derive | Apache-2.0 | https://crates.io/crates/miette-derive | +| mimalloc | MIT | https://crates.io/crates/mimalloc | | mime | MIT, Apache-2.0 | https://crates.io/crates/mime | | minicbor | BlueOak-1.0.0 | https://crates.io/crates/minicbor | | minicbor-derive | BlueOak-1.0.0 | https://crates.io/crates/minicbor-derive | diff --git a/implementations/rust/ockam/ockam_command/Cargo.toml b/implementations/rust/ockam/ockam_command/Cargo.toml index e571acebdca..84b75c622fb 100644 --- a/implementations/rust/ockam/ockam_command/Cargo.toml +++ b/implementations/rust/ockam/ockam_command/Cargo.toml @@ -63,6 +63,7 @@ hex = "0.4" indicatif = "0.17.8" indoc = "2.0.5" miette = { version = "7.2.0", features = ["fancy-no-backtrace"] } +mimalloc = { version = "0.1", features = ["secure"] } minicbor = { version = "0.25.1", default-features = false, features = ["alloc", "derive"] } nix = { version = "0.29", features = ["signal"] } ockam = { path = "../ockam", version = "^0.145.0", features = ["software_vault"] } diff --git a/implementations/rust/ockam/ockam_command/src/bin/ockam.rs b/implementations/rust/ockam/ockam_command/src/bin/ockam.rs index b5169010620..04d273d49b3 100644 --- a/implementations/rust/ockam/ockam_command/src/bin/ockam.rs +++ b/implementations/rust/ockam/ockam_command/src/bin/ockam.rs @@ -2,8 +2,12 @@ // binary names. The issue is that we need to avoid the `ockam` binary colliding // with the `ockam` crate. +use mimalloc::MiMalloc; use ockam_command::util::exitcode; +#[global_allocator] +static GLOBAL: MiMalloc = MiMalloc; + fn main() { if let Err(e) = ockam_command::entry_point::run() { // initialization errors are displayed here diff --git a/tools/stress-test/Cargo.toml b/tools/stress-test/Cargo.toml index 0e56f027c11..47a5086b437 100644 --- a/tools/stress-test/Cargo.toml +++ b/tools/stress-test/Cargo.toml @@ -13,6 +13,7 @@ rust-crypto = ["ockam/rust-crypto"] [dependencies] clap = { version = "4.5", features = ["derive", "cargo"] } +mimalloc = { version = "0.1", features = ["secure"] } ockam = { path = "../../implementations/rust/ockam/ockam" } ockam_api = { path = "../../implementations/rust/ockam/ockam_api" } ockam_core = { path = "../../implementations/rust/ockam/ockam_core" } diff --git a/tools/stress-test/src/main.rs b/tools/stress-test/src/main.rs index 7a530ee8520..0b505681153 100644 --- a/tools/stress-test/src/main.rs +++ b/tools/stress-test/src/main.rs @@ -24,6 +24,11 @@ mod execution; mod portal_simulator; mod stats; +use mimalloc::MiMalloc; + +#[global_allocator] +static GLOBAL: MiMalloc = MiMalloc; + #[derive(Debug, Args, Clone)] struct RunCommand { config: PathBuf,