Opened 6 weeks ago
Last modified 34 hours ago
#24955 new enhancement
Memory leaks, performance issues across core
| Reported by: | gaben | Owned by: | team |
|---|---|---|---|
| Priority: | major | Milestone: | 26.12 |
| Component: | Core | Version: | |
| Keywords: | performance memory leak gc | Cc: | GerdP |
Description
I've done some profiling and found some issues around many common code paths, which affect every user.
While I don't currently have exact numbers, the memory gains should be significant, especially during long editing sessions, ranging from few hundred megabytes to possibly gigabytes. Also, many listeners were left registered after deleted layers, thousands of them.
There are also some performance issues; funniest for me, the selection performance is held back by the conflict manager panel, which checks every object, even when there is no conflict. Only if the panel is visible.
I'll be publishing the patch soon as well.
Attachments (0)
Change History (8)
comment:1 by , 5 weeks ago
| Keywords: | performance memory leak gc added |
|---|---|
| Milestone: | → Longterm |
comment:2 by , 3 weeks ago
comment:3 by , 3 weeks ago
Here's my JOSM.cfg that does aggressive garbage cleaning, yet still see JOSM at times sitting at 8GB RAM use, and I tend to work with very large data sets. If I though let JOSM sit for a while, it shaves off GBs memory use off the footprint. There's one point to make: Every update the installer is good to somehow delete my JOSM.cfg and put a new one in and the only seeming dif being the version number in the standard... this line "java-options=-Djpackage.app-version=1.5.19613" so it would be good if the installer just updates that line instead of ditching the user version painstakingly assembled and tested. Anyway, with my .cfg got a very stable environment. Thx.
[Application]
app.classpath=$APPDIR\josm-custom.jar
app.mainclass=org.openstreetmap.josm.gui.MainApplication
[JavaOptions]
java-options=-Djpackage.app-version=1.5.19613
java-options=-XX:MaxRAMPercentage=50.0
java-options=-Xms256m
java-options=-XX:+UseG1GC
java-options=-XX:G1PeriodicGCInterval=3000
java-options=-XX:+ShrinkHeapInSteps
java-options=--add-modules
java-options=java.scripting,java.sql,javafx.controls,javafx.media,javafx.swing,javafx.web
java-options=--add-exports=java.base/sun.security.action=ALL-UNNAMED
java-options=--add-exports=java.desktop/com.sun.imageio.plugins.jpeg=ALL-UNNAMED
java-options=--add-exports=java.desktop/com.sun.imageio.spi=ALL-UNNAMED
java-options=--add-opens=java.base/java.lang=ALL-UNNAMED
java-options=--add-opens=java.base/java.nio=ALL-UNNAMED
java-options=--add-opens=java.base/jdk.internal.loader=ALL-UNNAMED
java-options=--add-opens=java.base/jdk.internal.ref=ALL-UNNAMED
java-options=--add-opens=java.desktop/javax.imageio.spi=ALL-UNNAMED
java-options=--add-opens=java.desktop/javax.swing.text.html=ALL-UNNAMED
java-options=--add-opens=java.prefs/java.util.prefs=ALL-UNNAMED
comment:5 by , 3 weeks ago
| Priority: | normal → major |
|---|---|
| Type: | defect → enhancement |
I'll push ~2.5 months of work on profiling GC, memory, CPU, threads and whatnot.
Also I think I left no leaks for others to fix, sorry :(
Expect 20-50 commits in this ticket later, or less, it depends on scoping.
comment:6 by , 3 weeks ago
Thanks Also again my eye dropped on that 75% allowed memory use. That very often blow my system and either causes JOSM or other Java intense apps to crash/freeze. The 50% got it at on 16GB ram is still rich but can work with that.
comment:7 by , 34 hours ago
Credit where credit is due. Whatever did it stepping from 19678 to 19700 on Windows 10, the memory leaking by the gigabytes seems to have been resolved, albeit my JOSM.cfg garbage collector lines are still in place, in fact added few more per below. Did not see a word here on the JOSM security bug I saw being flagged in the OSMF newsletter for JAVA which got fixed in 25.0.5.1, my 4770 CPU per research does not have the instruction set that got attacked, but since the JOSM about box notes 25.0.5.1 as in this 19700 build certainly feel saver again. At any rate the ballooning to 8GB RAM use is not happening anymore and letting JOSM sit only shaves little off the memory use footprint. Thx
[JavaOptions]
java-options=-Djpackage.app-version=1.5.19700
java-options=-XX:MaxRAMPercentage=50.0
java-options=-Xms256m
java-options=-XX:+UseG1GC
java-options=-XX:G1PeriodicGCInterval=3000
java-options=-XX:+ShrinkHeapInSteps
java-options=-XX:MaxHeapFreeRatio=40
java-options=-XX:MinHeapFreeRatio=20
# java-options=-XX:+ExitOnOutOfMemoryError
# note above line disabled on recommendation.
java-options=-XX:G1ReservePercent=15
comment:8 by , 34 hours ago
| Milestone: | Longterm → 26.12 |
|---|



After the Java 17 migration (#17858).