diff --git a/Cargo.lock b/Cargo.lock index 73fa76cc58..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" @@ -1518,11 +1523,6 @@ dependencies = [ "serde 1.0.101 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "heaptrack" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" - [[package]] name = "hibitset" version = "0.5.4" @@ -1653,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" @@ -3655,7 +3674,7 @@ dependencies = [ name = "veloren-server-cli" version = "0.3.0" dependencies = [ - "heaptrack 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "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", @@ -3684,8 +3703,8 @@ dependencies = [ "glutin 0.21.1 (registry+https://github.com/rust-lang/crates.io-index)", "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)", - "heaptrack 0.3.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)", @@ -4033,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" @@ -4075,7 +4095,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum gzip-header 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "0131feb3d3bb2a5a238d8a4d09f6353b7ebfdc52e77bccbf4ea6eaa751dde639" "checksum hashbrown 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e1de41fb8dba9714efd92241565cdff73f78508c95697dd56787d3cba27e2353" "checksum hashbrown 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2bcea5b597dd98e6d1f1ec171744cc5dee1a30d1c23c5b98e3cf9d4fbdf8a526" -"checksum heaptrack 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8a5f3c2341045ae29cc6d1004caf4c043addd7b658f9d11464fd6914dff6609b" "checksum hibitset 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)" = "6527bc88f32e0d3926c7572874b2bf17a19b36978aacd0aacf75f7d27a5992d0" "checksum hound 3.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8a164bb2ceaeff4f42542bdb847c41517c78a60f5649671b2a07312b6e117549" "checksum httparse 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "cd179ae861f0c2e53da70d892f5f3029f9594be0c41dc5269cd371691b1dc2f9" @@ -4091,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 0dcf7735a4..193bee8163 100644 --- a/server-cli/Cargo.toml +++ b/server-cli/Cargo.toml @@ -8,6 +8,6 @@ edition = "2018" server = { package = "veloren-server", path = "../server" } common = { package = "veloren-common", path = "../common" } -heaptrack = "0.3.0" 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 feafbdd6d0..5d76bfb444 100644 --- a/server-cli/src/main.rs +++ b/server-cli/src/main.rs @@ -1,13 +1,17 @@ #![deny(unsafe_code)] +#[cfg(not(target_env = "msvc"))] +use jemallocator::Jemalloc; + +#[cfg(not(target_env = "msvc"))] +#[global_allocator] +static GLOBAL: Jemalloc = Jemalloc; + use common::clock::Clock; -use heaptrack::track_mem; use log::info; use server::{Event, Input, Server, ServerSettings}; use std::time::Duration; -track_mem!(); - const TPS: u64 = 30; fn main() { diff --git a/voxygen/Cargo.toml b/voxygen/Cargo.toml index e2ce3f220e..cab9d6243d 100644 --- a/voxygen/Cargo.toml +++ b/voxygen/Cargo.toml @@ -10,7 +10,7 @@ gl = ["gfx_device_gl"] discord = ["discord-rpc-sdk", "lazy_static"] singleplayer = ["server", "portpicker"] -default = ["gl", "singleplayer", "msgbox", "heaptrack"] +default = ["gl", "singleplayer", "msgbox"] [dependencies] common = { package = "veloren-common", path = "../common" } @@ -59,10 +59,10 @@ rand = "0.7.0" frustum_query = "0.1.2" rodio = "0.9.0" crossbeam = "0.7.2" -heaptrack = { version = "0.3.0", optional = true } 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 fb6fac48a3..65255bbcf6 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_env = "msvc"))] +use jemallocator::Jemalloc; + +#[cfg(not(target_env = "msvc"))] +#[global_allocator] +static GLOBAL: Jemalloc = Jemalloc; + #[macro_use] pub mod ui; pub mod anim; @@ -38,11 +45,6 @@ use log::{self, debug, error, info}; use simplelog::{CombinedLogger, Config, TermLogger, TerminalMode, WriteLogger}; use std::{fs::File, mem, panic, str::FromStr}; -#[cfg(feature = "heaptrack")] -use heaptrack::track_mem; -#[cfg(feature = "heaptrack")] -track_mem!(); - /// A type used to store state that is shared between all play states. pub struct GlobalState { settings: Settings,