﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc
5173	memory leak in search dialog	adjuva@…	team	"Hello!

After doing between 50 to 100 search operations in the search dialog i get a 'JOSM is out of memory. Strange things ...'-Error. My Computer (32 Bit Windows XP with Java 1.6) has 512 MB of memory an i assigned 150 MB to JOSM. The effect is reproducible:

- Start JOSM with option '-Xmx150m'

- The state report from the help menu follows. Missing characters (for privacy) are marked by [...]:

{{{
Repository Root: http://josm.openstreetmap.de/svn
Build-Date: 2010-06-11 01:31:34
Last Changed Author: stoecker
Revision: 3329
Repository UUID: 0c6e7542-c601-0410-84e7-c038aed88b3b
URL: http://josm.openstreetmap.de/svn/trunk
Last Changed Date: 2010-06-10 09:53:42 +0200 (Thu, 10 Jun 2010)
Last Changed Rev: 3329

Identification: JOSM/1.5 (3329 de)
Memory Usage: 36 MB / 145 MB (16 MB allocated, but free)
Java version: 1.6.0_20, Sun Microsystems Inc., Java HotSpot(TM) Client VM
Operating system: Windows XP

Plugin: AddrInterpolation (21710)
Plugin: measurement (21706)
Plugin: openstreetbugs (21706)
Plugin: remotecontrol (21706)
Plugin: wmsplugin (21667)

audio.menuinvisible=true
cache.geoimage-thumbnails.expire=-1
cache.geoimage-thumbnails.maxsize=120
cache.motd.html=1277137544
cache.motd.html.lang=De:
cache.motd.html.version=3329
cache.wmsplugin.expire=2419200
cache.wmsplugin.maxsize=70
changeset-query.advanced.time-restrictions.query-type=closed-after
color.gps marker=#FF00FF
color.gps point=#FF00FF
commandstack.visible=false
coordinates=DECIMAL_DEGREES
download.newlayer=true
draw.rawgps.colors=1
draw.rawgps.direction=true
draw.rawgps.lines=false
draw.rawgps.lines.layer 20091101.gpx=false
draw.rawgps.lines.localfiles=true
filters.filter.0=1;type:node -power=towerr;add;false;false;legacy;false;true;false;false
[...]
geoimage.bounds=-161,54,1164,700
geoimage.delta=-3557000
geoimage.docked=false
geoimage.timezone=+1:00
geoimage.timezoneid=Europe/Berlin
graphview.activeBookmark=bicycle
graphview.defaultNodeColor=255, 255, 255
graphview.defaultSegmentColor=255, 255, 255
graphview.parameterBookmarks=[...]
graphview.rulesetFolder=[...]
graphview.rulesetResource=GERMANY
gui.geometry=1152x841+0+0
gui.maximized=true
history.bounds=407,326,338,180
josm.version=3329
[...]
mappaint.fontsize=11
mappaint.use-antialiasing=true
marker.audiofromstart=false
marker.buttonlabels=false
message.movedManyElements.value=1
[...]
org.openstreetmap.josm.actions.OpenLocationAction.uploadAddressHistory=[...]
org.openstreetmap.josm.gui.actionsupport.DeleteFromRelationConfirmationDialog.geometry=x=376,y=316,width=400,height=200
org.openstreetmap.josm.gui.conflict.tags.CombinePrimitiveResolverDialog.geometry=x=96,y=87,width=780,height=529
org.openstreetmap.josm.gui.conflict.tags.TagConflictResolver.showTagsWithConflictsOnly=true
org.openstreetmap.josm.gui.dialogs.changeset.query.ChangesetQueryDialog.geometry=x=300,y=100,width=400,height=400
org.openstreetmap.josm.gui.dialogs.relation.GenericRelationEditor.geometry=x=431,y=118,width=700,height=647
org.openstreetmap.josm.gui.download.DownloadDialog.geometry=x=6,y=0,width=1105,height=824
org.openstreetmap.josm.gui.help.HelpBrowser.geometry=x=240,y=196,width=800,height=600
org.openstreetmap.josm.gui.io.CloseChangesetDialog.geometry=x=426,y=266,width=300,height=300
org.openstreetmap.josm.gui.io.UploadDialog.geometry=x=221,y=139,width=632,height=600
org.openstreetmap.josm.gui.preferences.PreferenceDialog.geometry=x=98,y=9,width=889,height=800
osb.api.disabled=false
osb.auto_download=true
osb.include_date=true
osb.new.history=Sind die StraÃŸen nach Norden und Osten korrekt angebunden?
osb.nickname=[...]
osb.uri.close=http://openstreetbugs.schokokeks.org/api/0.1/closePOIexec
osb.uri.download=http://openstreetbugs.schokokeks.org/api/0.1/getBugs
osb.uri.edit=http://openstreetbugs.schokokeks.org/api/0.1/editPOIexec
osb.uri.new=http://openstreetbugs.schokokeks.org/api/0.1/addPOIexec
osm-download.bounds=51.013322699999996;7.0212078;51.0142406;7.0223236
osm-primitives.showid=true
osm-server.upload-strategy=singlerequest
pluginmanager.lastupdate=1269052172015
pluginmanager.time-based-update.policy=never
pluginmanager.version=3094
pluginmanager.version-based-update.policy=never
plugins=[...]
propertiesdialog.bounds=407,326,338,180
proxy.policy=no-proxy
save.keepbackup=false
search.history=[...]
shortcut.groups.1=128
shortcut.groups.10=64
shortcut.groups.11=576
shortcut.groups.12=64
shortcut.groups.13=512
shortcut.groups.15=640
shortcut.groups.16=640
shortcut.groups.17=576
shortcut.groups.18=512
shortcut.groups.19=128
shortcut.groups.2=128
shortcut.groups.20=512
shortcut.groups.3=0
shortcut.groups.4=512
shortcut.groups.5=0
shortcut.groups.6=512
shortcut.groups.8=192
shortcut.groups.9=192
shortcut.groups.configured=true
slippymap.autoload_tiles=true
slippymap.autozoom=true
slippymap.draw_debug=false
slippymap.fade_background=0.0
slippymap.max_zoom_lvl=17
slippymap.min_zoom_lvl=13
slippymap.tile_url=http://tah.openstreetmap.org/Tiles/tile
tagimages.delta=-13000
tagimages.lastdirectory=[...]
toggleDialogs.width=410
toolbar=[...]
upload.comment.history=[...]
validator.tests=[...]
validator.testsBeforeUpload=[...]
wmsplugin.alpha_channel=false
wmsplugin.default.html:http://josm.openstreetmap.de/wmsplugin/YahooDirect.html?=true
wmsplugin.default.http://onearth.jpl.nasa.gov/wms.cgi?request_GetMap&layers_global_mosaic&styles_&format_image/jpeg&=true
wmsplugin.default.http://openaerialmap.org/wms/?VERSION_1.0&request_GetMap&layers_world&styles_&format_image/jpeg&=true
[...]
wmsplugin.url.10.name=Yahoo Sat
wmsplugin.url.10.url=html:http://josm.openstreetmap.de/wmsplugin/YahooDirect.html?
wmsplugin.url.2.name=Dortmund
wmsplugin.url.2.url=http://wms.openstreetmap.de/wms?LAYERS=Dortmund&
wmsplugin.url.3.name=Dortmund#PPD=6.6623807946001045E7
wmsplugin.url.3.url=http://wms.openstreetmap.de/wms?LAYERS=Dortmund&
wmsplugin.url.4.name=LandSat
wmsplugin.url.4.url=http://onearth.jpl.nasa.gov/wms.cgi?request=GetMap&layers=global_mosaic&styles=&format=image/jpeg&
wmsplugin.url.5.name=Lauf
wmsplugin.url.5.url=http://wms.openstreetmap.de/wms?layers=Lauf&
[...]
wmsplugin.url.9.name=OpenAerial-Karte
wmsplugin.url.9.url=http://openaerialmap.org/wms/?VERSION=1.0&request=GetMap&layers=world&styles=&format=image/jpeg&
wmsplugin.url.overlap=false
wmsplugin.url.overlapEast=14
wmsplugin.url.overlapNorth=4
}}}

- open a OSM file. In my case it is a 3 MB file with 11 relations, 1373 ways and 13800 nodes. 87 Elements are marked as modified. The file is a modified result of this XAPI request: '/api/0.6/*[power=*][bbox=5.5,50.0,8.0,51.2]'.

- The memory usage is now:

> Memory Usage: 64 MB / 145 MB (36 MB allocated, but free)

- to create a normalized environment:

  - press '1' to show all data. A scale of '33 km' is shown on my computer.

  - deactivate the filters

  - remove all panels from the right side

- press Ctrl-F and type 'power=line'. The radio button selects the upper option. All checkboxes are deactivated.

- Press 'Enter'. 991 ways are found. Repeat pressing 'Ctrl-F' and 'Enter' 19 times. The memory usage is now:

> Memory Usage: 108 MB / 145 MB (39 MB allocated, but free)

- Repeat pressing 'Ctrl-F' and 'Enter' 20 times. The memory usage is now:

> Memory Usage: 145 MB / 145 MB (19 MB allocated, but free)

- Repeat pressing 'Ctrl-F' and 'Enter' 30 times and you get the exception. I got the exception after a total of 55 to 65 searches.

- The java output in the shell window follows. Missing characters are marked by [...]:

{{{
Repository Root: http://josm.openstreetmap.de/svn
Build-Date: 2010-06-11 01:31:34
Last Changed Author: stoecker
Revision: 3329
Repository UUID: 0c6e7542-c601-0410-84e7-c038aed88b3b
URL: http://josm.openstreetmap.de/svn/trunk
Last Changed Date: 2010-06-10 09:53:42 +0200 (Thu, 10 Jun 2010)
Last Changed Rev: 3329

_berspringe Plugin-Aktualisierung nach JOSM-Upgrade. Automatische Aktualisierung
 beim Start ist deaktiviert.
lade Plugin 'openstreetbugs' (Version 21706)
lade Plugin 'wmsplugin' (Version 21667)
lade Plugin 'remotecontrol' (Version 21706)
lade Plugin 'AddrInterpolation' (Version 21710)
RemoteControl::Accepting connections on port 8111
lade Plugin 'measurement' (Version 21706)
Open file: [...]
Silent shortcut conflict: 'view:openstreetbugs' moved by 'system:download_primitive' to 'Strg+Alt+O'.
java.lang.OutOfMemoryError: Java heap space
        at java.awt.image.DataBufferInt.<init>(Unknown Source)
        at java.awt.image.Raster.createPackedRaster(Unknown Source)
        at java.awt.image.DirectColorModel.createCompatibleWritableRaster(Unknown Source)
        at sun.awt.image.SunVolatileImage.getBackupImage(Unknown Source)
        at sun.awt.image.VolatileSurfaceManager.getBackupSurface(Unknown Source)

        at sun.awt.image.VolatileSurfaceManager.initialize(Unknown Source)
        at sun.awt.image.SunVolatileImage.<init>(Unknown Source)
        at sun.awt.image.SunVolatileImage.<init>(Unknown Source)
        at sun.awt.image.SunVolatileImage.<init>(Unknown Source)
        at sun.awt.image.SunVolatileImage.<init>(Unknown Source)
        at sun.awt.windows.WComponentPeer.createVolatileImage(Unknown Source)
        at java.awt.Component.createVolatileImage(Unknown Source)
        at java.awt.Component$BltBufferStrategy.createBackBuffers(Unknown Source)
        at java.awt.Component$BltBufferStrategy.<init>(Unknown Source)
        at java.awt.Component$BltSubRegionBufferStrategy.<init>(Unknown Source)
        at java.awt.Component.createBufferStrategy(Unknown Source)
        at java.awt.Window.createBufferStrategy(Unknown Source)
        at javax.swing.BufferStrategyPaintManager$BufferInfo.createBufferStrategy(Unknown Source)
        at javax.swing.BufferStrategyPaintManager$BufferInfo.createBufferStrategy(Unknown Source)
        at javax.swing.BufferStrategyPaintManager$BufferInfo.getBufferStrategy(Unknown Source)
        at javax.swing.BufferStrategyPaintManager.prepare(Unknown Source)
        at javax.swing.BufferStrategyPaintManager.paint(Unknown Source)
        at javax.swing.RepaintManager.paint(Unknown Source)
        at javax.swing.JComponent.paint(Unknown Source)
        at java.awt.GraphicsCallback$PaintCallback.run(Unknown Source)
        at sun.awt.SunGraphicsCallback.runOneComponent(Unknown Source)
        at sun.awt.SunGraphicsCallback.runComponents(Unknown Source)
        at java.awt.Container.paint(Unknown Source)
        at java.awt.Window.paint(Unknown Source)
        at javax.swing.RepaintManager.paintDirtyRegions(Unknown Source)
        at javax.swing.RepaintManager.paintDirtyRegions(Unknown Source)
        at javax.swing.RepaintManager.seqPaintDirtyRegions(Unknown Source)
java.lang.OutOfMemoryError: Java heap space
        at java.awt.image.DataBufferInt.<init>(Unknown Source)
        at java.awt.image.Raster.createPackedRaster(Unknown Source)
        at java.awt.image.DirectColorModel.createCompatibleWritableRaster(Unknown Source)
        at sun.awt.image.SunVolatileImage.getBackupImage(Unknown Source)
        at sun.awt.image.VolatileSurfaceManager.getBackupSurface(Unknown Source)

        at sun.awt.image.VolatileSurfaceManager.initialize(Unknown Source)
        at sun.awt.image.SunVolatileImage.<init>(Unknown Source)
        at sun.awt.image.SunVolatileImage.<init>(Unknown Source)
        at sun.awt.image.SunVolatileImage.<init>(Unknown Source)
        at sun.awt.image.SunVolatileImage.<init>(Unknown Source)
        at sun.awt.windows.WComponentPeer.createVolatileImage(Unknown Source)
        at java.awt.Component.createVolatileImage(Unknown Source)
        at java.awt.Component$BltBufferStrategy.createBackBuffers(Unknown Source)
        at java.awt.Component$BltBufferStrategy.<init>(Unknown Source)
        at java.awt.Component$BltSubRegionBufferStrategy.<init>(Unknown Source)
        at java.awt.Component.createBufferStrategy(Unknown Source)
        at java.awt.Window.createBufferStrategy(Unknown Source)
        at javax.swing.BufferStrategyPaintManager$BufferInfo.createBufferStrategy(Unknown Source)
        at javax.swing.BufferStrategyPaintManager$BufferInfo.createBufferStrategy(Unknown Source)
        at javax.swing.BufferStrategyPaintManager$BufferInfo.getBufferStrategy(Unknown Source)
        at javax.swing.BufferStrategyPaintManager.prepare(Unknown Source)
        at javax.swing.BufferStrategyPaintManager.paint(Unknown Source)
        at javax.swing.RepaintManager.paint(Unknown Source)
        at javax.swing.JComponent._paintImmediately(Unknown Source)
        at javax.swing.JComponent.paintImmediately(Unknown Source)
        at javax.swing.RepaintManager.paintDirtyRegions(Unknown Source)
        at javax.swing.RepaintManager.paintDirtyRegions(Unknown Source)
        at javax.swing.RepaintManager.seqPaintDirtyRegions(Unknown Source)
        at javax.swing.SystemEventQueueUtilities$ComponentWorkRequest.run(Unknown Source)
        at java.awt.event.InvocationEvent.dispatch(Unknown Source)
        at java.awt.EventQueue.dispatchEvent(Unknown Source)
        at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
}}}

The same effect appears with a more complex search expression like 'power=line -frequency:'. This expression founds 600 ways and 10 more searches a needed to get the exception.

To ensure that the searching is the problem (and not the marking of the found elements) i tried to ""simulate"" it by pressing 'Ctrl-A' and 'u' 50 times, but the memory usage was not increasing.

> Memory Usage: 64 MB / 145 MB (14 MB allocated, but free)

"	defect	closed	normal		Core	tested	fixed	memory leak search dialog	
