Skip to content

Commit

Permalink
fix: use new memory allocator 'jemallocator' in aggregator
Browse files Browse the repository at this point in the history
This will likely avoid having memory fragmentation resulting in RES memory not being correctly released.
  • Loading branch information
jpraynaud committed Apr 25, 2024
1 parent b18bed9 commit e05ebd2
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

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

6 changes: 6 additions & 0 deletions mithril-aggregator/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ uuid = { version = "1.7.0", features = ["v4", "fast-rng", "macro-diagnostics"] }
warp = "0.3.6"
zstd = { version = "0.13.0", features = ["zstdmt"] }

[target.'cfg(not(target_env = "msvc"))'.dependencies]
tikv-jemallocator = { version = "0.5.4", optional = true }

[dev-dependencies]
httpmock = "0.7.0"
mithril-common = { path = "../mithril-common", features = [
Expand All @@ -57,4 +60,7 @@ slog-term = "2.9.0"
tempfile = "3.9.0"

[features]
default = ["jemallocator"]

bundle_openssl = ["dep:openssl", "dep:openssl-probe"]
jemallocator = ["dep:tikv-jemallocator"]
8 changes: 8 additions & 0 deletions mithril-aggregator/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,14 @@ pub use tools::{
#[cfg(test)]
pub use dependency_injection::tests::initialize_dependencies;

// Memory allocator (to handle properly memory fragmentation)
#[cfg(all(not(target_env = "msvc"), feature = "jemallocator"))]
use tikv_jemallocator::Jemalloc;

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

#[cfg(test)]
pub(crate) mod test_tools {
use slog::Drain;
Expand Down

0 comments on commit e05ebd2

Please sign in to comment.