Skip to content

Commit 9c34fdc

Browse files
authored
chore: enable jemalloc (#82)
enable jemalloc
1 parent 1301e82 commit 9c34fdc

File tree

4 files changed

+27
-0
lines changed

4 files changed

+27
-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
@@ -65,6 +65,7 @@ googletest = { version = "0.14.0" }
6565
humansize = { version = "2.1.3" }
6666
indent = { version = "0.1.1" }
6767
insta = { version = "1.42.2" }
68+
jemallocator = { version = "0.5.4" }
6869
jiff = { version = "0.2", features = ["serde"] }
6970
local-ip-address = { version = "0.6.3" }
7071
log = { version = "0.4.27", features = ["kv"] }

crates/core/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ release = false
3131
exn = { workspace = true }
3232
fastimer = { workspace = true }
3333
foyer = { workspace = true }
34+
jemallocator = { workspace = true }
3435
jiff = { workspace = true }
3536
log = { workspace = true }
3637
pin-project = { workspace = true }

crates/core/src/runtime.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@ use std::task::ready;
1919
use std::time::Duration;
2020
use std::time::Instant;
2121

22+
#[cfg(not(target_env = "msvc"))]
23+
#[global_allocator]
24+
static GLOBAL: jemallocator::Jemalloc = jemallocator::Jemalloc;
25+
2226
pub fn make_runtime(runtime_name: &str, thread_name: &str, worker_threads: usize) -> Runtime {
2327
log::info!(
2428
"creating runtime with runtime_name: {runtime_name}, thread_name: {thread_name}, work_threads: {worker_threads}"

0 commit comments

Comments
 (0)