Skip to content

Commit 74e4b61

Browse files
EddieHoustonphilippem
authored andcommitted
perf(alloc): use jemalloc to reduce memory fragmentation
Replace the system allocator (glibc malloc) with jemalloc via tikv-jemallocator. Reduces RSS by ~18% by eliminating malloc fragmentation that accumulates over time with RocksDB's allocation patterns.
1 parent dc14551 commit 74e4b61

File tree

3 files changed

+25
-0
lines changed

3 files changed

+25
-0
lines changed

Cargo.lock

Lines changed: 21 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ page_size = "0.6.0"
4949
prometheus = "0.14"
5050
rayon = "1.5.0"
5151
rocksdb = "0.24"
52+
tikv-jemallocator = "0.6"
5253
rust-crypto = "0.2"
5354
serde = "1.0.118"
5455
serde_derive = "1.0.118"

src/bin/electrs.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
#[global_allocator]
2+
static GLOBAL: tikv_jemallocator::Jemalloc = tikv_jemallocator::Jemalloc;
3+
14
extern crate error_chain;
25
#[macro_use]
36
extern crate log;

0 commit comments

Comments
 (0)