#18749 closed enhancement (fixed)
Fix issues reported by Heap Hero
| Reported by: | simon04 | Owned by: | simon04 |
|---|---|---|---|
| Priority: | normal | Milestone: | 20.02 |
| Component: | Core | Version: | |
| Keywords: | memory heap intern heaphero svg svgsalamander | Cc: |
Description (last modified by )
The heap bump has been obtained from running JOSM r15898 on a fresh profile and loading the attached dataset.
Build-Date:2020-02-22 17:26:08 Revision:15898 Is-Local-Build:true Identification: JOSM/1.5 (15898 SVN en_GB) Linux Arch Linux Memory Usage: 829 MB / 3531 MB (658 MB allocated, but free) Java version: 1.8.0_242-b08, Oracle Corporation, OpenJDK 64-Bit Server VM Screen: :0.0 3840x2160 Maximum Screen Size: 3840x2160 VM arguments: [-Djosm.home=<josm.pref>/] Program arguments: [--set=expert=true, --set=iso.dates=true] Dataset consistency test: No problems found
Attachments (2)
Change History (36)
by , 6 years ago
comment:1 by , 6 years ago
| Keywords: | svg added |
|---|
comment:4 by , 6 years ago
| Keywords: | svg added |
|---|
follow-up: 6 comment:5 by , 6 years ago
The svg issue is still open: https://github.com/blackears/svgSalamander/issues/36
follow-up: 10 comment:6 by , 6 years ago
Replying to GerdP:
The svg issue is still open: https://github.com/blackears/svgSalamander/issues/36
You should open a Pull Request instead.
comment:7 by , 6 years ago
| Description: | modified (diff) |
|---|
by , 6 years ago
| Attachment: | 18749.patch added |
|---|
comment:8 by , 6 years ago
With attachment:18749.patch applied, the "5. Duplicate Strings / Wasted Memory" goes down from 9.7mb to 4.64mb
follow-up: 11 comment:9 by , 6 years ago
| Milestone: | → 20.02 |
|---|
comment:10 by , 6 years ago
Replying to Don-vip:
Replying to GerdP:
The svg issue is still open: https://github.com/blackears/svgSalamander/issues/36
You should open a Pull Request instead.
I still don't know how to open a Pull Requests. I hope I don't have to learn it for JOSM, whenever I tried to work with git I was searching for the right way to undo something in my local directory and ended in messed up code. Getting old...
I think the negative comment regarding String.intern() usage stopped my issue.
follow-ups: 12 17 comment:11 by , 6 years ago
Replying to GerdP:
I still don't know how to open a Pull Requests.
You might want to use the GitHub website to make an edit and create a PR: https://help.github.com/en/github/managing-files-in-a-repository/editing-files-in-another-users-repository
How's your svgSalamander workflow? We make modifications to our copy and at the same time try to get the changes upstream via a PR?
comment:12 by , 6 years ago
Replying to simon04:
We make modifications to our copy and at the same time try to get the changes upstream via a PR?
Yes. It can take many months before svgSalamander PR are merged, so we clearly don't want to wait.
comment:17 by , 6 years ago
Replying to simon04:
Replying to GerdP:
I still don't know how to open a Pull Requests.
You might want to use the GitHub website to make an edit and create a PR: https://help.github.com/en/github/managing-files-in-a-repository/editing-files-in-another-users-repository
Thanks for the link. That looks easy enough for me.
comment:18 by , 6 years ago
I submitted two upstream PR for svgSalamander (extracted from r15901 and r15904, respectively):
- Intern strings to reduce memory footprint by simon04 · Pull Request
#52· https://github.com/blackears/svgSalamander/pull/52 - SVGElement: store String instead of StyleAttribute in map by simon04 · Pull Request
#53· https://github.com/blackears/svgSalamander/pull/53
comment:21 by , 6 years ago
There are, for sure ;). But it shouldn't hinder us from releasing a new tested. I can always open a follow-up ticket for the next milestone.
comment:22 by , 6 years ago
| Resolution: | → fixed |
|---|---|
| Status: | assigned → closed |
comment:23 by , 6 years ago
Which kinds of memory savings have been seen during the testing of this patch? (just for the record)
comment:24 by , 6 years ago
The reports:
- r15898: https://heaphero.io/my-heap-report.jsp?p=YXJjaGl2ZWQvMjAyMC8wMi8yMi8tLWhlYXBkdW1wLTE1ODIzODQ0NjA5NjIuaHByb2YuZ3otMTUtMTYtNy5qc29uLS0= (Java version: 1.8.0_242-b08, Oracle Corporation, OpenJDK 64-Bit Server VM)
- r15925: https://heaphero.io/my-heap-report.jsp?p=YXJjaGl2ZWQvMjAyMC8wMi8yNC8tLWhlYXBkdW1wLTE1ODI1Nzc2MTYwMjkuaHByb2YuZ3otMjAtNTQtMzAuanNvbi0t (Java version: 1.8.0_242-b08, Oracle Corporation, OpenJDK 64-Bit Server VM)
r15925: https://heaphero.io/my-heap-report.jsp?p=YXJjaGl2ZWQvMjAyMC8wMi8yNC8tLWhlYXBkdW1wLTE1ODI1Nzc0ODA0NDcuaHByb2YuZ3otMjAtNTItMTYuanNvbi0t(Java version: 15-ea+11-373, Oracle Corporation, OpenJDK 64-Bit Server VM)
The numbers:
- Object Headers 19.92 → 18.19mb
- Duplicate Strings 9.7 → 4.5mb
- Inefficient collections 6.4 → 5.4mb
- Duplicate Objects 2.3 → 1.2mb
comment:25 by , 6 years ago
Last time that I looked at this I wondered why we keep both the parsed svg data and the rendered image in the heap, possibly also the svg source files in a cache.
comment:30 by , 6 years ago
| Keywords: | svgsalamander added |
|---|
follow-up: 32 comment:31 by , 6 years ago
FYI: I've noticed that the *.svg file in the svn repo are much larger than the ones included in the jar files produced by Jenkins. Seems that there is a compressor which removes lots of strings. No idea if that has an influence on the memory footprint?
comment:32 by , 6 years ago
Replying to GerdP:
Seems that there is a compressor which removes lots of strings.
Yes we use https://github.com/RazrFalcon/svgcleaner but a patched version iirc.
comment:33 by , 6 years ago
I think r15909 introduced a performance regresssion. Field conds used to be null for empty collections, now it is never null. In Selector.MatchingReferrerFinder.doVisit() this means that a costly sequential search is performed much more often.
This "kills" JOSM when ways with many nodes are processed.



Looks like svgSalamander is responsible for many of the issues.