Index: trunk/native/linux/tested/usr/bin/josm
===================================================================
--- trunk/native/linux/tested/usr/bin/josm	(revision 19018)
+++ 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"
 
