Skip to content

Commit

Permalink
perf: use tikv-jemallocator
Browse files Browse the repository at this point in the history
  • Loading branch information
TheWaWaR committed Dec 2, 2023
1 parent 2d7bd33 commit 7883ac1
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
3 changes: 3 additions & 0 deletions akasa/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,6 @@ log = "0.4.17"
dashmap = "5.4.0"
rpassword = "7.2.0"
rand = { version = "0.8.5", features = ["getrandom"] }

[target.'cfg(not(target_env = "msvc"))'.dependencies]
tikv-jemallocator = "0.5.4"
7 changes: 7 additions & 0 deletions akasa/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,13 @@ use rand::{rngs::OsRng, RngCore};

use default_hook::DefaultHook;

#[cfg(not(target_env = "msvc"))]
use tikv_jemallocator::Jemalloc;

#[cfg(not(target_env = "msvc"))]
#[global_allocator]
static GLOBAL: Jemalloc = Jemalloc;

#[derive(Parser, Debug)]
#[clap(author, version, about, long_about = None)]
/// Akasa MQTT server
Expand Down

1 comment on commit 7883ac1

@TheWaWaR
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When use system allocator, it seems have memory leaks and can't detected by heaptrack.

Please sign in to comment.