From 56bda46ddd9202d7d5485792fc2062fc69b6ed07 Mon Sep 17 00:00:00 2001 From: Greg Burri Date: Wed, 30 Jun 2021 08:29:28 +0200 Subject: [PATCH] Adjust the reported memory from the java process. --- Cargo.lock | 14 ++++++++++---- backend/src/minecraft_controller.rs | 2 +- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index a370b18..b2fdbf9 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -526,7 +526,7 @@ dependencies = [ "cached_proc_macro", "cached_proc_macro_types", "futures", - "hashbrown", + "hashbrown 0.9.1", "once_cell", ] @@ -988,6 +988,12 @@ version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d7afe4a420e3fe79967a00898cc1f4db7c8a49a9333a29f8a4bd76a253d5cd04" +[[package]] +name = "hashbrown" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ab5ef0d4909ef3724cc8cce6ccc8572c5c817592e9285f5464f8e86f8bd3726e" + [[package]] name = "heck" version = "0.3.3" @@ -1059,12 +1065,12 @@ dependencies = [ [[package]] name = "indexmap" -version = "1.6.2" +version = "1.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "824845a0bf897a9042383849b02c1bc219c2383772efcd5c6f9766fa4b81aef3" +checksum = "bc633605454125dec4b66843673f01c7df2b89479b32e0ed634e43a91cff62a5" dependencies = [ "autocfg", - "hashbrown", + "hashbrown 0.11.2", ] [[package]] diff --git a/backend/src/minecraft_controller.rs b/backend/src/minecraft_controller.rs index 8b06f66..7af13dd 100644 --- a/backend/src/minecraft_controller.rs +++ b/backend/src/minecraft_controller.rs @@ -144,7 +144,7 @@ pub fn get_minecraft_executable_information(world_path: &str, backup_path: &str, Some( MinecraftExe { - memory: process.memory(), + memory: process.memory() / 3, // Because the Java garbage collector ZGC reports three times more the real memory usage: https://stackoverflow.com/a/62934057/212675 load_average_5min: system.get_load_average().five / system.get_processors().len() as f64 * 100., uptime: std::time::SystemTime::now().duration_since(std::time::UNIX_EPOCH).unwrap().as_secs() - process.start_time(), world_size, -- 2.43.0