Changeset 19215 in josm


Ignore:
Timestamp:
2024-09-09T18:54:09+02:00 (2 months ago)
Author:
taylor.smock
Message:

Fix #23837: Set -XX:MaxRAMPercentage to >25% of system memory

This does not currently work for WebStart, see
https://github.com/AdoptOpenJDK/IcedTea-Web/pull/954 .

As noted in the ticket, all supported MS Windows and Apple macOS machines have
4G+ of RAM. Linux machines don't have a baseline, and some have 1G or less. Where
we detect that a machine has <8G of memory in the linux start scripts, we don't
add the JVM parameters.

As a reminder to everyone reading the changelog: just because we ask for the
ability to use 75% of the system memory doesn't mean we will use all of that
memory. The JVM will free up unused memory for the rest of the system.

We additionally set the minimum memory allocation to 256m; while this can be
lower, that is for minimal amounts of data loaded. A clean JOSM install will use
99mb, for example. But once we add a minimal amount of data and a background
layer, static memory usage goes up to 161mb.

Location:
trunk/native
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/native/josm-latest.jnlp

    r19110 r19215  
    2121    </security>
    2222    <resources>
    23         <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"/>
     23        <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"/>
    2424        <jar href="josm-latest.jar"/>
    2525    </resources>
  • trunk/native/josm.jnlp

    r19110 r19215  
    2121    </security>
    2222    <resources>
    23         <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"/>
     23        <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"/>
    2424        <jar href="josm-tested.jar"/>
    2525        <!-- This was removed from josm-latest.jnlp on 2024-06-17. Remove if nothing gets reported. -->
  • trunk/native/linux/latest/etc/default/josm-latest

    r18699 r19215  
    33
    44# Increase usable memory
    5 #JAVA_OPTS="-Xmx2048m ${JAVA_OPTS}"
     5#JAVA_OPTS="-XX:MaxRAMPercentage=75.0 -Xms256m ${JAVA_OPTS}"
    66
    77# Enable OpenGL pipeline (2D graphic accelerators)
  • trunk/native/linux/latest/usr/bin/josm-latest

    r19018 r19215  
    5858fi
    5959
     60# If there is more than 8G ram, we can use up to 75% of the memory while still leaving 2G for other things.
     61if [ "$(free --mega | grep '^Mem:' | awk '{print $2}')" -gt 8192 ]; then
     62    # But don't set anything if JAVA_OPTS is already set.
     63    JAVA_OPTS="${JAVA_OPTS:=-XX:MaxRAMPercentage=75.0 -Xms256m}"
     64fi
     65
    6066JAVA_OPTS="-Djosm.restart=true -Djosm.dir.name=JOSM-latest -Djava.net.useSystemProxies=true $JAVA_OPTS"
    6167
  • trunk/native/linux/tested/etc/default/josm

    r18699 r19215  
    33
    44# Increase usable memory
    5 #JAVA_OPTS="-Xmx2048m ${JAVA_OPTS}"
     5#JAVA_OPTS="-XX:MaxRAMPercentage=75.0 -Xms256m ${JAVA_OPTS}"
    66
    77# Enable OpenGL pipeline (2D graphic accelerators)
  • trunk/native/linux/tested/usr/bin/josm

    r19018 r19215  
    5858fi
    5959
     60# If there is more than 8G ram, we can use up to 75% of the memory while still leaving 2G for other things.
     61if [ "$(free --mega | grep '^Mem:' | awk '{print $2}')" -gt 8192 ]; then
     62    # But don't set anything if JAVA_OPTS is already set.
     63    JAVA_OPTS="${JAVA_OPTS:=-XX:MaxRAMPercentage=75.0 -Xms256m}"
     64fi
     65
    6066JAVA_OPTS="-Djosm.restart=true -Djava.net.useSystemProxies=true $JAVA_OPTS"
    6167
  • trunk/native/macosx/macos-jpackage.sh

    r19061 r19215  
    6060      --main-class org.openstreetmap.josm.gui.MainApplication \
    6161      --icon ./native/macosx/JOSM.icns --type app-image --dest app \
     62      --java-options "-XX:MaxRAMPercentage=75.0" \
     63      --java-options "-Xms256m" \
    6264      --java-options "--add-modules java.scripting,java.sql,javafx.controls,javafx.media,javafx.swing,javafx.web" \
    6365      --java-options "--add-exports=java.base/sun.security.action=ALL-UNNAMED" \
  • trunk/native/windows/win-jpackage.sh

    r19051 r19215  
    5252    --main-class org.openstreetmap.josm.gui.MainApplication \
    5353    --icon ./native/windows/logo.ico --type $type --dest app \
     54    --java-options "-XX:MaxRAMPercentage=75.0" \
     55    --java-options "-Xms256m" \
    5456    --java-options "--add-modules java.scripting,java.sql,javafx.controls,javafx.media,javafx.swing,javafx.web" \
    5557    --java-options "--add-exports=java.base/sun.security.action=ALL-UNNAMED" \
Note: See TracChangeset for help on using the changeset viewer.