Skip to content

Commit

Permalink
feat(rust): to reduce memory fragmentation use mimalloc in command an…
Browse files Browse the repository at this point in the history
…d stress-test
  • Loading branch information
davide-baldo authored and SanjoDeundiak committed Dec 17, 2024
1 parent 87ef083 commit 86753fb
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 0 deletions.
21 changes: 21 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions NOTICE.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 |
Expand All @@ -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 |
Expand Down
1 change: 1 addition & 0 deletions implementations/rust/ockam/ockam_command/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"] }
Expand Down
4 changes: 4 additions & 0 deletions implementations/rust/ockam/ockam_command/src/bin/ockam.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions tools/stress-test/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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" }
Expand Down
5 changes: 5 additions & 0 deletions tools/stress-test/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 86753fb

Please sign in to comment.