Index: /trunk/native/josm-latest.jnlp
===================================================================
--- /trunk/native/josm-latest.jnlp	(revision 19214)
+++ /trunk/native/josm-latest.jnlp	(revision 19215)
@@ -21,5 +21,5 @@
     </security>
     <resources>
-        <java version="11+" vendor="Azul" java-vm-args="--add-modules=java.scripting,java.sql,javafx.controls,javafx.media,javafx.swing,javafx.web --add-exports=java.base/sun.security.action=ALL-UNNAMED --add-exports=java.desktop/com.apple.eawt=ALL-UNNAMED --add-exports=java.desktop/com.sun.imageio.spi=ALL-UNNAMED --add-exports=java.desktop/com.sun.imageio.plugins.jpeg=ALL-UNNAMED --add-exports=javafx.graphics/com.sun.javafx.application=ALL-UNNAMED --add-exports=jdk.deploy/com.sun.deploy.config=ALL-UNNAMED --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.nio=ALL-UNNAMED --add-opens=java.base/jdk.internal.loader=ALL-UNNAMED --add-opens=java.base/jdk.internal.ref=ALL-UNNAMED --add-opens=java.desktop/javax.imageio.spi=ALL-UNNAMED --add-opens=java.desktop/javax.swing.text.html=ALL-UNNAMED --add-opens=java.prefs/java.util.prefs=ALL-UNNAMED"/>
+        <java version="11+" vendor="Azul" java-vm-args="-XX:MaxRAMPercentage=75.0 -Xms256m --add-modules=java.scripting,java.sql,javafx.controls,javafx.media,javafx.swing,javafx.web --add-exports=java.base/sun.security.action=ALL-UNNAMED --add-exports=java.desktop/com.apple.eawt=ALL-UNNAMED --add-exports=java.desktop/com.sun.imageio.spi=ALL-UNNAMED --add-exports=java.desktop/com.sun.imageio.plugins.jpeg=ALL-UNNAMED --add-exports=javafx.graphics/com.sun.javafx.application=ALL-UNNAMED --add-exports=jdk.deploy/com.sun.deploy.config=ALL-UNNAMED --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.nio=ALL-UNNAMED --add-opens=java.base/jdk.internal.loader=ALL-UNNAMED --add-opens=java.base/jdk.internal.ref=ALL-UNNAMED --add-opens=java.desktop/javax.imageio.spi=ALL-UNNAMED --add-opens=java.desktop/javax.swing.text.html=ALL-UNNAMED --add-opens=java.prefs/java.util.prefs=ALL-UNNAMED"/>
         <jar href="josm-latest.jar"/>
     </resources>
Index: /trunk/native/josm.jnlp
===================================================================
--- /trunk/native/josm.jnlp	(revision 19214)
+++ /trunk/native/josm.jnlp	(revision 19215)
@@ -21,5 +21,5 @@
     </security>
     <resources>
-        <java version="11+" vendor="Azul" java-vm-args="--add-modules=java.scripting,java.sql,javafx.controls,javafx.media,javafx.swing,javafx.web --add-exports=java.base/sun.security.action=ALL-UNNAMED --add-exports=java.desktop/com.apple.eawt=ALL-UNNAMED --add-exports=java.desktop/com.sun.imageio.spi=ALL-UNNAMED --add-exports=java.desktop/com.sun.imageio.plugins.jpeg=ALL-UNNAMED --add-exports=javafx.graphics/com.sun.javafx.application=ALL-UNNAMED --add-exports=jdk.deploy/com.sun.deploy.config=ALL-UNNAMED --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.nio=ALL-UNNAMED --add-opens=java.base/jdk.internal.loader=ALL-UNNAMED --add-opens=java.base/jdk.internal.ref=ALL-UNNAMED --add-opens=java.desktop/javax.imageio.spi=ALL-UNNAMED --add-opens=java.desktop/javax.swing.text.html=ALL-UNNAMED --add-opens=java.prefs/java.util.prefs=ALL-UNNAMED"/>
+        <java version="11+" vendor="Azul" java-vm-args="-XX:MaxRAMPercentage=75.0 -Xms256m --add-modules=java.scripting,java.sql,javafx.controls,javafx.media,javafx.swing,javafx.web --add-exports=java.base/sun.security.action=ALL-UNNAMED --add-exports=java.desktop/com.apple.eawt=ALL-UNNAMED --add-exports=java.desktop/com.sun.imageio.spi=ALL-UNNAMED --add-exports=java.desktop/com.sun.imageio.plugins.jpeg=ALL-UNNAMED --add-exports=javafx.graphics/com.sun.javafx.application=ALL-UNNAMED --add-exports=jdk.deploy/com.sun.deploy.config=ALL-UNNAMED --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.nio=ALL-UNNAMED --add-opens=java.base/jdk.internal.loader=ALL-UNNAMED --add-opens=java.base/jdk.internal.ref=ALL-UNNAMED --add-opens=java.desktop/javax.imageio.spi=ALL-UNNAMED --add-opens=java.desktop/javax.swing.text.html=ALL-UNNAMED --add-opens=java.prefs/java.util.prefs=ALL-UNNAMED"/>
         <jar href="josm-tested.jar"/>
         <!-- This was removed from josm-latest.jnlp on 2024-06-17. Remove if nothing gets reported. -->
Index: /trunk/native/linux/latest/etc/default/josm-latest
===================================================================
--- /trunk/native/linux/latest/etc/default/josm-latest	(revision 19214)
+++ /trunk/native/linux/latest/etc/default/josm-latest	(revision 19215)
@@ -3,5 +3,5 @@
 
 # Increase usable memory
-#JAVA_OPTS="-Xmx2048m ${JAVA_OPTS}"
+#JAVA_OPTS="-XX:MaxRAMPercentage=75.0 -Xms256m ${JAVA_OPTS}"
 
 # Enable OpenGL pipeline (2D graphic accelerators)
Index: /trunk/native/linux/latest/usr/bin/josm-latest
===================================================================
--- /trunk/native/linux/latest/usr/bin/josm-latest	(revision 19214)
+++ /trunk/native/linux/latest/usr/bin/josm-latest	(revision 19215)
@@ -58,4 +58,10 @@
 fi
 
+# If there is more than 8G ram, we can use up to 75% of the memory while still leaving 2G for other things.
+if [ "$(free --mega | grep '^Mem:' | awk '{print $2}')" -gt 8192 ]; then
+    # But don't set anything if JAVA_OPTS is already set.
+    JAVA_OPTS="${JAVA_OPTS:=-XX:MaxRAMPercentage=75.0 -Xms256m}"
+fi
+
 JAVA_OPTS="-Djosm.restart=true -Djosm.dir.name=JOSM-latest -Djava.net.useSystemProxies=true $JAVA_OPTS"
 
Index: /trunk/native/linux/tested/etc/default/josm
===================================================================
--- /trunk/native/linux/tested/etc/default/josm	(revision 19214)
+++ /trunk/native/linux/tested/etc/default/josm	(revision 19215)
@@ -3,5 +3,5 @@
 
 # Increase usable memory
-#JAVA_OPTS="-Xmx2048m ${JAVA_OPTS}"
+#JAVA_OPTS="-XX:MaxRAMPercentage=75.0 -Xms256m ${JAVA_OPTS}"
 
 # Enable OpenGL pipeline (2D graphic accelerators)
Index: /trunk/native/linux/tested/usr/bin/josm
===================================================================
--- /trunk/native/linux/tested/usr/bin/josm	(revision 19214)
+++ /trunk/native/linux/tested/usr/bin/josm	(revision 19215)
@@ -58,4 +58,10 @@
 fi
 
+# If there is more than 8G ram, we can use up to 75% of the memory while still leaving 2G for other things.
+if [ "$(free --mega | grep '^Mem:' | awk '{print $2}')" -gt 8192 ]; then
+    # But don't set anything if JAVA_OPTS is already set.
+    JAVA_OPTS="${JAVA_OPTS:=-XX:MaxRAMPercentage=75.0 -Xms256m}"
+fi
+
 JAVA_OPTS="-Djosm.restart=true -Djava.net.useSystemProxies=true $JAVA_OPTS"
 
Index: /trunk/native/macosx/macos-jpackage.sh
===================================================================
--- /trunk/native/macosx/macos-jpackage.sh	(revision 19214)
+++ /trunk/native/macosx/macos-jpackage.sh	(revision 19215)
@@ -60,4 +60,6 @@
       --main-class org.openstreetmap.josm.gui.MainApplication \
       --icon ./native/macosx/JOSM.icns --type app-image --dest app \
+      --java-options "-XX:MaxRAMPercentage=75.0" \
+      --java-options "-Xms256m" \
       --java-options "--add-modules java.scripting,java.sql,javafx.controls,javafx.media,javafx.swing,javafx.web" \
       --java-options "--add-exports=java.base/sun.security.action=ALL-UNNAMED" \
Index: /trunk/native/windows/win-jpackage.sh
===================================================================
--- /trunk/native/windows/win-jpackage.sh	(revision 19214)
+++ /trunk/native/windows/win-jpackage.sh	(revision 19215)
@@ -52,4 +52,6 @@
     --main-class org.openstreetmap.josm.gui.MainApplication \
     --icon ./native/windows/logo.ico --type $type --dest app \
+    --java-options "-XX:MaxRAMPercentage=75.0" \
+    --java-options "-Xms256m" \
     --java-options "--add-modules java.scripting,java.sql,javafx.controls,javafx.media,javafx.swing,javafx.web" \
     --java-options "--add-exports=java.base/sun.security.action=ALL-UNNAMED" \
