uses tikv_jemallocator::Jemalloc as the global allocator (backport #20149) (#20166)

* uses tikv_jemallocator::Jemalloc as the global allocator (#20149)

https://github.com/solana-labs/solana/pull/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 2cf081d863)

# Conflicts:
#	Cargo.lock

* removes backport merge conflicts

Co-authored-by: behzad nouri <behzadnouri@gmail.com>
This commit is contained in:
mergify[bot]
2021-09-24 17:37:57 +00:00
committed by GitHub
parent e757e51ddc
commit 085f5f945d
3 changed files with 32 additions and 0 deletions

View File

@@ -50,6 +50,9 @@ solana-version = { path = "../version", version = "=1.7.13" }
solana-vote-program = { path = "../programs/vote", version = "=1.7.13" }
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"

View File

@@ -78,6 +78,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,