Java heap space
Answered
Hey,
i got always an error "Java heap space" Out of memory exception. If i type -Xmx1024m in VM options my process is working a little bit longer but also get this exception. If i try with 2048 i got another error "Could not reserve enough space for 2097152KB object heap". This problem occured on Windows 8 with IntelliJ Idea 2017.1 x64 ultimate. When i try it on ubuntu i dont get any errors about heap space. My Java Version is 1.8. Can anyone help me with that ?
Please sign in to leave a comment.
Switch to 64-bit JDK for IntelliJ IDEA, project, Maven, etc, see https://intellij-support.jetbrains.com/hc/articles/207241105 for the explanation of the problem.
IntelliJ IDEA JDK can be changed per https://intellij-support.jetbrains.com/hc/articles/206544879.
Project JDK is configured in the Project Structure dialog, Maven runner and other tools use project SDK by default.
Thanks for the answer. It is working better now, after applying the things according to the second link. But i still have the same error "Java Heap Space" just a few steps later...
Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
at geotrellis.raster.IntArrayTile.toBytes(IntArrayTile.scala:38)
at geotrellis.raster.CroppedTile.toBytes(CroppedTile.scala:206)
at geotrellis.raster.io.geotiff.GeoTiffMultibandTile$.apply(GeoTiffMultibandTile.scala:123)
at geotrellis.raster.io.geotiff.GeoTiffMultibandTile$.apply(GeoTiffMultibandTile.scala:85)
at geotrellis.raster.io.geotiff.MultibandGeoTiff.imageData(MultibandGeoTiff.scala:40)
at geotrellis.raster.io.geotiff.writer.GeoTiffWriter.<init>(GeoTiffWriter.scala:62)
at geotrellis.raster.io.geotiff.writer.GeoTiffWriter$.write(GeoTiffWriter.scala:35)
at geotrellis.raster.io.geotiff.GeoTiff$class.write(GeoTiff.scala:63)
at geotrellis.raster.io.geotiff.MultibandGeoTiff.write(MultibandGeoTiff.scala:25)
at tutorial.MaskBandsRandGandNIR$.main(MaskBandsRandGandNIR.scala:59)
at tutorial.MaskBandsRandGandNIR.main(MaskBandsRandGandNIR.scala)
Does it happen when you run your own application from IntelliJ IDEA? In this case you need to give more RAM to the app, not to IntelliJ IDEA.
Edit the VM Options field in the run/debug configuration of the app that you start.
It's an application i dowloaded from GitHub. I tried already to give more RAM in the VM Options, but then there was the Error "Could not reserve enough space for 2097152KB object heap". Is there any other way?
Use 64-bit Java to run the app as already suggested.
ok, it's working now without any Error. Thanks