Skip to content

Commit

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

* uses tikv_jemallocator::Jemalloc as the global allocator (solana-labs#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.

(cherry picked from commit 2cf081d)

# Conflicts:
#	Cargo.lock

* removes backport merge conflicts

Co-authored-by: behzad nouri <behzadnouri@gmail.com>
  • Loading branch information
mergify[bot] and behzadnouri committed Sep 24, 2021
1 parent ca83167 commit 53e03f7
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 @@ -50,6 +50,9 @@ solana-version = { path = "../version", version = "=1.7.12" }
solana-vote-program = { path = "../programs/vote", version = "=1.7.12" }
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.81"
signal-hook = "0.1.15"
Expand Down
7 changes: 7 additions & 0 deletions validator/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,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 53e03f7

Please sign in to comment.