diff --git a/Cargo.lock b/Cargo.lock index 1460b27893..9426879f7f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1078,6 +1078,11 @@ name = "frustum_query" version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "fs_extra" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "fsevent" version = "0.4.0" @@ -1648,6 +1653,25 @@ name = "itoa" version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "jemalloc-sys" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cc 1.0.45 (registry+https://github.com/rust-lang/crates.io-index)", + "fs_extra 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "jemallocator" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "jemalloc-sys 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "jpeg-decoder" version = "0.1.16" @@ -3650,6 +3674,7 @@ dependencies = [ name = "veloren-server-cli" version = "0.3.0" dependencies = [ + "jemallocator 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "pretty_env_logger 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "veloren-common 0.3.0", @@ -3679,6 +3704,7 @@ dependencies = [ "guillotiere 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", "hashbrown 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", "image 0.22.2 (registry+https://github.com/rust-lang/crates.io-index)", + "jemallocator 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "msgbox 0.2.0 (git+https://github.com/bekker/msgbox-rs.git)", @@ -4026,6 +4052,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum foreign-types 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" "checksum foreign-types-shared 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" "checksum frustum_query 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e1771c26abed26b2527d888742fffd27dab86d205bf4846748abf29c06ef5a05" +"checksum fs_extra 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5f2a4a2034423744d2cc7ca2068453168dcdb82c438419e639a26bd87839c674" "checksum fsevent 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5ab7d1bd1bd33cc98b0889831b72da23c0aa4df9cec7e0702f46ecea04b35db6" "checksum fsevent-sys 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "f41b048a94555da0f42f1d632e2e19510084fb8e303b0daa2816e733fb3644a0" "checksum fuchsia-cprng 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "a06f77d526c1a601b7c4cdd98f54b5eaabffc14d5f2f0296febdc7f357c6d3ba" @@ -4083,6 +4110,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum iovec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "dbe6e417e7d0975db6512b90796e8ce223145ac4e33c377e4a42882a0e88bb08" "checksum itertools 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5b8467d9c1cebe26feb08c640139247fac215782d35371ade9a2136ed6085358" "checksum itoa 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)" = "501266b7edd0174f8530248f87f99c88fbe60ca4ef3dd486835b8d8d53136f7f" +"checksum jemalloc-sys 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "0d3b9f3f5c9b31aa0f5ed3260385ac205db665baa41d49bb8338008ae94ede45" +"checksum jemallocator 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "43ae63fcfc45e99ab3d1b29a46782ad679e98436c3169d15a167a1108a724b69" "checksum jpeg-decoder 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)" = "c1aae18ffeeae409c6622c3b6a7ee49792a7e5a062eea1b135fbb74e301792ba" "checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" "checksum khronos_api 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e2db585e1d738fc771bf08a151420d3ed193d9d895a36df7f6f8a9456b911ddc" diff --git a/server-cli/Cargo.toml b/server-cli/Cargo.toml index f36e29da55..193bee8163 100644 --- a/server-cli/Cargo.toml +++ b/server-cli/Cargo.toml @@ -10,3 +10,4 @@ common = { package = "veloren-common", path = "../common" } log = "0.4.8" pretty_env_logger = "0.3.0" +jemallocator = "0.3.2" diff --git a/server-cli/src/main.rs b/server-cli/src/main.rs index f19022a709..6954b5839f 100644 --- a/server-cli/src/main.rs +++ b/server-cli/src/main.rs @@ -1,5 +1,12 @@ #![deny(unsafe_code)] +#[cfg(not(target_os = "windows"))] +use jemallocator::Jemalloc; + +#[cfg(not(target_os = "windows"))] +#[global_allocator] +static GLOBAL: Jemalloc = Jemalloc; + use common::clock::Clock; use log::info; use server::{Event, Input, Server, ServerSettings}; diff --git a/voxygen/Cargo.toml b/voxygen/Cargo.toml index 16c3831439..cab9d6243d 100644 --- a/voxygen/Cargo.toml +++ b/voxygen/Cargo.toml @@ -62,6 +62,7 @@ crossbeam = "0.7.2" hashbrown = { version = "0.5.0", features = ["serde", "nightly"] } chrono = "0.4.7" rust-argon2 = "0.5" +jemallocator = "0.3.2" [target.'cfg(windows)'.build-dependencies] winres = "0.1" diff --git a/voxygen/src/main.rs b/voxygen/src/main.rs index 8018da180d..0ff0bc408c 100644 --- a/voxygen/src/main.rs +++ b/voxygen/src/main.rs @@ -12,6 +12,13 @@ pub mod discord; #[cfg(feature = "discord")] use std::sync::Mutex; +#[cfg(not(target_os = "windows"))] +use jemallocator::Jemalloc; + +#[cfg(not(target_os = "windows"))] +#[global_allocator] +static GLOBAL: Jemalloc = Jemalloc; + #[macro_use] pub mod ui; pub mod anim;