Skip to content

Commit

Permalink
feat: turn balance system allocator;
Browse files Browse the repository at this point in the history
  • Loading branch information
Mr.Panda committed Dec 31, 2023
1 parent 52da044 commit 7afb693
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Cargo.lock

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

9 changes: 9 additions & 0 deletions turn-balance/server/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,12 @@ num_cpus = "1.15"

[build-dependencies]
prost-build = "0.12"

[target.'cfg(not(target_os = "windows"))'.dependencies]
jemallocator = "0.5.4"

[target.'cfg(target_os = "windows")'.dependencies]
mimalloc = "0.1.37"

[features]
system_allocator = []
8 changes: 8 additions & 0 deletions turn-balance/server/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
#[global_allocator]
#[cfg(all(target_os = "windows", not(feature = "system_allocator")))]
static GLOBAL: mimalloc::MiMalloc = mimalloc::MiMalloc;

#[global_allocator]
#[cfg(all(not(target_os = "windows"), not(feature = "system_allocator")))]
static GLOBAL: jemallocator::Jemalloc = jemallocator::Jemalloc;

mod cluster;
mod config;

Expand Down

0 comments on commit 7afb693

Please sign in to comment.