heap space OutOfMemory loading pictures

neilbryant's picture

I apologize if this is a newbie question. I suspect it's down to properly configuring Java, but I don't seem to be getting it right. I can tag a couple of photos, just fine, and they show up on the map as they should, but if I load about the third, I get a heap error.

1178746 - Time to convert: 39ms
Exception in thread "Image Fetcher 0" java.lang.OutOfMemoryError: Java heap space
at java.awt.image.DataBufferInt.(DataBufferInt.java:75)
at java.awt.image.Raster.createPackedRaster(Raster.java:470)
at java.awt.image.DirectColorModel.createCompatibleWritableRaster(DirectColorModel.java:1032)
at sun.awt.image.ImageRepresentation.createBufferedImage(ImageRepresentation.java:253)
at sun.awt.image.ImageRepresentation.setPixels(ImageRepresentation.java:510)
at sun.awt.image.ImageDecoder.setPixels(ImageDecoder.java:138)
at sun.awt.image.JPEGImageDecoder.sendPixels(JPEGImageDecoder.java:114)
at sun.awt.image.JPEGImageDecoder.readImage(Native Method)
at sun.awt.image.JPEGImageDecoder.produceImage(JPEGImageDecoder.java:136)
at sun.awt.image.InputStreamImageSource.doFetch(InputStreamImageSource.java:264)
at sun.awt.image.ImageFetcher.fetchloop(ImageFetcher.java:189)
at sun.awt.image.ImageFetcher.run(ImageFetcher.java:153)

The photos are large (4000x3000), but the files are only about 3Mb. I'm running the Latest_rxtx2 web launch on Fedora11 64-bit under OpenJDK. I've tried expanding the avaialble space (javaws -Xms762m http://soft.bt747.org/BT747_J2SE_Latest_rxtx2_2p2.jnlp) as high as -Xms1024m, but it doesn't seem to make any difference. If anybody knows the answer, or just if I'm heading the right/wrong direction with the -Xms switch, I would be greatful.

mdeweerd's picture

Hi I checked the option in


I checked the option in the startup scripts and I have -Xmx192m  - you have something like -Xms192m so the option may be wrongly set in your case.

In the jnlp file I have  <j2se version="1.5+" max-heap-size="192m"/> .

Changing the jnlp locally is not sufficient unless in the jnlp you set the codebase to the local path - otherwise the jnlp will be fetched from the web.

The heap issue is related to the thumbnail creation and should not have an impact on the tagging itself.  A limited number of thumbnails is created in parallel, I think I had set it to 5 or so.

Also check how much memory your app really uses to make sure that the heap option has an effect.

Hopefully this helps to get the option right.  I intended to revisit the thumbnail creation code and even try to extract the thumbnail already in the JPEG, but I did not get around to that yet.