JOSM and lack of memory

I have been struggling with JOSM recently. Editing responses are so slow at times. Bing imagery appears to be a factor: it struggles to refresh. The worst moment came today when an error message appeared, informing me JOSM is out of memory. I was unable to close that window and right-clicking the JOSM icon at the foot of the screen to “Close window” did not work. I had to shut down the desktop and restart. Nothing like this has happened before in my nine years of working with JOSM. Its version is 13053, the latest.

Incidentally, I’ve also seen a similar issue. Windows is notifying me there’s not enough RAM. Never happened before.

It’s just cropped up on the “talk” list too: https://lists.openstreetmap.org/pipermail/talk/2017-November/079535.html .

Yes, today i noticed problems in version 13053, almost unusable.

You can use the task manager and close the Java process instead of having to reboot your computer.

Not my own solution (it has come up in other threads) but add this line in your JNLP file to allow 1GB of memory for example:

<java version="1.8+" initial-heap-size="256m" max-heap-size="1024m"/>

JOSM.jnlp should look like this now

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE jnlp PUBLIC "-//Sun Microsystems, Inc//DTD JNLP Descriptor 6.0//EN" "http://java.sun.com/dtd/JNLP-6.0.dtd">
<jnlp spec="6.0+" codebase="https://josm.openstreetmap.de/download/" href="josm.jnlp">
    <information>
        <title>JOSM</title>
        <vendor>OpenStreetMap</vendor> 
        <homepage href="https://josm.openstreetmap.de"/> 
        <description>Java OpenStreetMap editor</description>
        <description kind="one-line">JOSM</description>
        <description kind="tooltip">JOSM</description>
        <icon href="https://josm.openstreetmap.de/svn/trunk/images/logo.png"/> 
        <offline-allowed/>
        <shortcut>
            <desktop/>
            <menu/>
        </shortcut>
    </information>
    <security>
        <all-permissions/>
    </security>
    <resources>
        <java version="1.8+" initial-heap-size="256m" max-heap-size="1024m"/>
        <jar href="josm-tested.jar"/>
        <property name="java.util.Arrays.useLegacyMergeSort" value="true"/>
    </resources>
    <application-desc main-class="JOSM"/>
</jnlp>

ff5722
I thank you for your constructive reply.

  1. I am pleased that adverse situations happen rarely on my PC, so I do not think of Task Manager immediately. I must make a note.
  2. I am not experienced in DOS and commands, particularly. .jlnp access appears to require the installation of Web Start from what I read and I imagine getting in over my head, which I resist, generally. I do not understand its association with the .jar file. either.

you can edit the jnlp file with the default text editor. To open it use javaws.exe in your java installation folder.

ff5722 and Klumbumbus
I have assimilated your two posts and another of Klumbumbus in https://forum.openstreetmap.org/viewtopic.php?id=52441:
The other way would be to download josm.jnlp, open this file in a text editor and replace the line

by

Save and then always start josm by double clicking on the jnlp file. You can adjust the max-heap-size to your needs. The advantage of the jnlp is, that it auto downloads if a new stable version is availible.
Not understanding from where to download josm.jnlp, I carried out an internet search. The first entry contained https://josm.openstreetmap.de/download/josm.jnlp, which downloaded the file. I opened the file in Notepad and added initial-heap-size=“256m” max-heap-size=“1024m” as shown in this extract:



I double-clicked josm.jnlp, which opened JOSM version 13053 (not the latest now, it seems, because I was informed I should update). That aside, my feeling was that the speed of refresh was much faster with my usual content: a .gpx file, downloaded data and Bing imagery.
I write this lengthy post, i. in order for both of you to confirm my actions were correct and ii. to help, perhaps, others of the same limited knowledge as me.

There are two different versions of josm with different jnlp files:

  • josm.jnlp uses always the current stable version, which is updated once a month. This is suitable for the default user. (current version 13053)

  • josm-latest.jnlp uses always the newest development version, which is updated every day. This is suitable for more advanced users as this version can contain small or big bugs. (current version 13119)

You can download both jnlp files here: https://josm.openstreetmap.de/

…it seems you already did fine. You can check if it worked by clicking in JOSM on menu Help → Show status report (https://josm.openstreetmap.de/wiki/Help/Action/ShowStatusReport) and look for the line e.g. “Memory Usage: 2057 MB / 3641 MB”. The first number (2057 in this case) is the current memory and the second (3641 in this case) is the maximum possible josm memory (which you defined with max-heap-size).

For the record, the problem I posted at the talk list was about hangs, and not memory consumption, and I am not sure whether the issues are or aren’t related.

Talk list: https://lists.openstreetmap.org/pipermail/talk/2017-November/079535.html
Issue tracker ticket: https://josm.openstreetmap.de/ticket/15547

Klumbumbus
I thank you for your additional information; I never knew of the Status Report in JOSM>Help>Show Status Report. I learn so much, still, through my use of various forums. What a marvellous source of information they prove to be. I am ever grateful.

Wanting to carry out edits in JOSM recently, I found my edited version of josm.jnlp, which I have been using since my last post here, would not open. Using instead josm-latest.jar works perfectly fine now unlike a year ago, nearly, which caused me to create this topic. I wonder, though, why josm.jnlp fails to open JOSM now and whether I can do something about it?

Sometime little changes a done to the jnlp file, so try downloading the current jnlp file from the josm website and try this version.
(Also note that since Java 11 jnlp files are not working anymore at all since oracle removed this feature.)

I encountered this problem multiple times in the past and now in the present. My computer has 4GB of memory but I don’t think that’s the problem, Java is instable and has lots of memory leaks, so after a long usage and many edits (such as 30 minutes), the memory consuption will go up and you have to save the work, close and re-open. Before it’s too late…

Java is really awful it’s a shame JOSM can’t work without it.

Which memory usage is shown in JOSMs status report?