Adjust the reported memory from the java process.
[minecraft_web.git] / backend / src / minecraft_controller.rs
index 8b06f66..7af13dd 100644 (file)
@@ -144,7 +144,7 @@ pub fn get_minecraft_executable_information(world_path: &str, backup_path: &str,
 \r
         Some(\r
             MinecraftExe {\r
-                memory: process.memory(),\r
+                memory: process.memory() / 3, // Because the Java garbage collector ZGC reports three times more the real memory usage: https://stackoverflow.com/a/62934057/212675\r
                 load_average_5min: system.get_load_average().five / system.get_processors().len() as f64 * 100.,\r
                 uptime: std::time::SystemTime::now().duration_since(std::time::UNIX_EPOCH).unwrap().as_secs() - process.start_time(),\r
                 world_size,\r