Skip to content

Commit

Permalink
uses tikv_jemallocator::Jemalloc as the global allocator (solana-labs…
Browse files Browse the repository at this point in the history
…#20149)

solana-labs#16346
switched default allocator from jemalloc to system allocator, but that
has shown regressions in form of higher ram usage causing nodes go OOM:
https://discord.com/channels/428295358100013066/439194979856809985/890413193858539580

This commit sets jemalloc as the default allocator.
  • Loading branch information
behzadnouri authored and dankelleher committed Nov 24, 2021
1 parent fddbabf commit effdfda
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 0 deletions.
22 changes: 22 additions & 0 deletions Cargo.lock

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

3 changes: 3 additions & 0 deletions validator/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ solana-version = { path = "../version", version = "=1.8.0" }
solana-vote-program = { path = "../programs/vote", version = "=1.8.0" }
symlink = "0.1.0"

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

[target."cfg(unix)".dependencies]
libc = "0.2.102"
signal-hook = "0.2.3"
Expand Down
7 changes: 7 additions & 0 deletions validator/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,13 @@ use {
},
};

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

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

#[derive(Debug, PartialEq)]
enum Operation {
Initialize,
Expand Down

0 comments on commit effdfda

Please sign in to comment.