From 93ce462636f98f03ae632a87e32edca7e968e8ea Mon Sep 17 00:00:00 2001 From: RaphiMC <50594595+RaphiMC@users.noreply.github.com> Date: Mon, 10 Apr 2023 19:48:09 +0200 Subject: [PATCH] Changed memory warn message --- .../java/net/raphimc/viaproxy/ViaProxy.java | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/src/main/java/net/raphimc/viaproxy/ViaProxy.java b/src/main/java/net/raphimc/viaproxy/ViaProxy.java index 95cd4e9..ea70c4f 100644 --- a/src/main/java/net/raphimc/viaproxy/ViaProxy.java +++ b/src/main/java/net/raphimc/viaproxy/ViaProxy.java @@ -98,13 +98,18 @@ public class ViaProxy { Logger.LOGGER.info("Using java version: " + System.getProperty("java.vm.name") + " " + System.getProperty("java.version") + " (" + System.getProperty("java.vendor") + ") on " + System.getProperty("os.name")); Logger.LOGGER.info("Available memory (bytes): " + Runtime.getRuntime().maxMemory()); - if (Runtime.getRuntime().maxMemory() < 512 * 1024 * 1024) { - Logger.LOGGER.fatal("ViaProxy is not able to run with less than 512MB of RAM."); - if (hasUI) { - JOptionPane.showMessageDialog(null, "ViaProxy is not able to run with less than 512MB of RAM.", "Critical Error", JOptionPane.ERROR_MESSAGE); - } - if (System.getProperty("ignoreSystemRequirements") == null) { + if (System.getProperty("ignoreSystemRequirements") == null) { + if (Runtime.getRuntime().maxMemory() < 256 * 1024 * 1024) { + Logger.LOGGER.fatal("ViaProxy is not able to run with less than 256MB of RAM."); + if (hasUI) { + JOptionPane.showMessageDialog(null, "ViaProxy is not able to run with less than 256MB of RAM.", "ViaProxy", JOptionPane.ERROR_MESSAGE); + } System.exit(1); + } else if (Runtime.getRuntime().maxMemory() < 512 * 1024 * 1024) { + Logger.LOGGER.warn("ViaProxy has less than 512MB of RAM. This may cause issues with multiple clients connected."); + if (hasUI) { + JOptionPane.showMessageDialog(null, "ViaProxy has less than 512MB of RAM. This may cause issues with multiple clients connected.", "ViaProxy", JOptionPane.WARNING_MESSAGE); + } } }