Skip to content

Commit

Permalink
Only use jemalloc on x86_64
Browse files Browse the repository at this point in the history
  • Loading branch information
tazz4843 committed Jun 29, 2024
1 parent 5d8b265 commit b4af4f8
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 2 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

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

4 changes: 3 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,11 @@ members = [
]

[dependencies]
tikv-jemallocator = "0.5"
scripty_core = { path = "scripty_core" }

[target.'cfg(target_arch = "x86_64")'.dependencies]
tikv-jemallocator = "0.5"

[patch.crates-io]
serenity = { git = "https://github.com/serenity-rs/serenity", branch = "next" }
songbird = { git = "https://github.com/serenity-rs/songbird", branch = "serenity-next" }
Expand Down
1 change: 1 addition & 0 deletions scripty_audio_handler/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ scripty_redis = { path = "../scripty_redis" }
scripty_automod = { path = "../scripty_automod" }
scripty_metrics = { path = "../scripty_metrics" }
scripty_premium = { path = "../scripty_premium" }
audiopus_sys = { version = "0.2", features = ["static"] }
scripty_integrations = { path = "../scripty_integrations" }
tokio = { version = "1", features = ["parking_lot"] }
scripty_data_storage = { path = "../scripty_data_storage" }
Expand Down
4 changes: 3 additions & 1 deletion scripty_core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ libc = "0.2"
rlimit = "0.10"
num_cpus = "1"
humantime = "2"
tikv-jemalloc-ctl = "0.5"
scripty_db = { path = "../scripty_db" }
scripty_bot = { path = "../scripty_bot" }
scripty_stt = { path = "../scripty_stt" }
Expand All @@ -26,3 +25,6 @@ scripty_webserver = { path = "../scripty_webserver" }
tokio = { version = "1", features = ["parking_lot", "rt-multi-thread"] }
scripty_data_storage = { path = "../scripty_data_storage" }
fenrir-rs = { git = "https://github.com/tazz4843/fenrir-rs", branch = "json-logs", features = ["reqwest-async", "json-log-fmt"] }

[target.'cfg(target_arch = "x86_64")'.dependencies]
tikv-jemalloc-ctl = "0.5"
3 changes: 3 additions & 0 deletions scripty_core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,14 @@ use fern::{
Dispatch,
};
use rlimit::Resource;
#[cfg(target_arch = "x86_64")]
use tikv_jemalloc_ctl::{epoch, stats};
use url::Url;

pub fn start() {
load_config();

#[cfg(target_arch = "x86_64")]
spawn_malloc_trim();

let rt = get_tokio_rt();
Expand Down Expand Up @@ -178,6 +180,7 @@ fn increase_open_file_limit() {
.expect("failed to increase open file limit: will likely cause issues with STT service");
}

#[cfg(target_arch = "x86_64")]
fn spawn_malloc_trim() {
std::thread::spawn(|| {
let emib = epoch::mib().expect("failed to get epoch mib");
Expand Down

0 comments on commit b4af4f8

Please sign in to comment.