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 committed Nov 26, 2024
1 parent a8acbe9 commit a545869
Show file tree
Hide file tree
Showing 5 changed files with 32 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.

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.141.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 @@ -23,6 +23,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 a545869

Please sign in to comment.