From 355f76d4e349dd54fc1e9c9aff1dbeea0b20ed61 Mon Sep 17 00:00:00 2001 From: Maik Marschner Date: Sat, 28 Oct 2023 00:25:34 +0200 Subject: [PATCH] Use the available physical memory as upper memory limit for the slider in the launcher. (#1433) * Use the available physical memory as upper memory limit for the slider in the launcher. * Update launcher/src/se/llbit/chunky/launcher/ui/ChunkyLauncherController.java Co-authored-by: Maximilian Stiede --------- Co-authored-by: Maximilian Stiede --- .../launcher/ui/ChunkyLauncherController.java | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/launcher/src/se/llbit/chunky/launcher/ui/ChunkyLauncherController.java b/launcher/src/se/llbit/chunky/launcher/ui/ChunkyLauncherController.java index 6d9db01901..1d4f3873b3 100644 --- a/launcher/src/se/llbit/chunky/launcher/ui/ChunkyLauncherController.java +++ b/launcher/src/se/llbit/chunky/launcher/ui/ChunkyLauncherController.java @@ -39,6 +39,7 @@ import java.awt.*; import java.io.File; import java.io.IOException; +import java.lang.management.ManagementFactory; import java.net.URL; import java.util.List; import java.util.ResourceBundle; @@ -114,7 +115,7 @@ public String getLabel(VersionInfo item) { memoryLimit.setTooltip("Maximum Java heap space in megabytes (MiB).\n" + "Limited by the available memory in your computer."); - memoryLimit.setRange(512, 1 << 14); + memoryLimit.setRange(512, getUpperMemoryLimitMb()); memoryLimit.makeLogarithmic(); memoryLimit.set(settings.memoryLimit); memoryLimit.onValueChange(value -> settings.memoryLimit = value); @@ -296,6 +297,16 @@ public void updateLauncher(Consumer errorCallback, Consumer