Modify

Opened 6 years ago

Closed 6 years ago

Last modified 6 years ago

#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 simon04)

https://heaphero.io/my-heap-report.jsp?p=YXJjaGl2ZWQvMjAyMC8wMi8yMi8tLWhlYXBkdW1wLTE1ODIzODQ0NjA5NjIuaHByb2YuZ3otMTUtMTYtNy5qc29uLS0=

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)

b.osm.bz2 (72.4 KB ) - added by simon04 6 years ago.
18749.patch (9.6 KB ) - added by simon04 6 years ago.

Download all attachments as: .zip

Change History (36)

by simon04, 6 years ago

Attachment: b.osm.bz2 added

comment:1 by Don-vip, 6 years ago

Keywords: svg added

Looks like svgSalamander is responsible for many of the issues.

comment:2 by Don-vip, 6 years ago

What version of Java were you running?

comment:3 by GerdP, 6 years ago

Keywords: svg removed

See kitfox.patch in #17040

comment:4 by GerdP, 6 years ago

Keywords: svg added

comment:5 by GerdP, 6 years ago

in reply to:  5 ; comment:6 by Don-vip, 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 simon04, 6 years ago

Description: modified (diff)

by simon04, 6 years ago

Attachment: 18749.patch added

comment:8 by simon04, 6 years ago

With attachment:18749.patch​ applied, the "5. Duplicate Strings / Wasted Memory" goes down from 9.7mb to 4.64mb

comment:9 by Don-vip, 6 years ago

Milestone: 20.02

in reply to:  6 comment:10 by GerdP, 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.

in reply to:  9 ; comment:11 by simon04, 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?

in reply to:  11 comment:12 by Don-vip, 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:13 by simon04, 6 years ago

In 15901/josm:

see #18749 - Intern strings to reduce memory footprint of svgSalamander

comment:14 by simon04, 6 years ago

In 15902/josm:

see #18749 - Intern strings to reduce memory footprint

comment:15 by simon04, 6 years ago

In 15904/josm:

see #18749 - SVGElement: store String instead of StyleAttribute in map

comment:16 by simon04, 6 years ago

In 15909/josm:

see #18749 - Use efficient/unmodifiable collections

in reply to:  11 comment:17 by GerdP, 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 simon04, 6 years ago

I submitted two upstream PR for svgSalamander (extracted from r15901 and r15904, respectively):

comment:19 by simon04, 6 years ago

In 15912/josm:

see #18749 - Use efficient/unmodifiable maps for svgSalamander

Version 0, edited 6 years ago by simon04 (next)

comment:20 by Don-vip, 6 years ago

Nice! Are there still issues to fix?

comment:21 by simon04, 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 simon04, 6 years ago

Resolution: fixed
Status: assignedclosed

comment:23 by tuxayo, 6 years ago

Which kinds of memory savings have been seen during the testing of this patch? (just for the record)

comment:24 by simon04, 6 years ago

The reports:

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 GerdP, 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:26 by simon04, 6 years ago

In 15934/josm:

see #18749 - Intern strings to reduce memory footprint

comment:27 by simon04, 6 years ago

In 15935/josm:

see #18749, see #16183 - Add non-regression test

comment:28 by simon04, 6 years ago

In 15949/josm:

see #18749, see #16183 - removeAreaStylePseudoClass not for validator MapCSS files

comment:29 by GerdP, 6 years ago

In 16031/josm:

see #18749: reduce memory footprint
errors array was allocated with 30 elements for each MapCSSTagCheckerAndRule instance

comment:30 by simon04, 6 years ago

Keywords: svgsalamander added

comment:31 by GerdP, 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?

in reply to:  31 comment:32 by Klumbumbus, 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 GerdP, 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.

comment:34 by GerdP, 6 years ago

In 16191/josm:

see #18749: fix performance regression introduced with r15909

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain simon04.
as The resolution will be set.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.