Java Heap space (the forester)

Hello everyone!



I’m trying to use the forester for importing trees and grass in my game.



The grass works perfectly well, but when I’m importing trees, I get an error :


Grave: Uncaught exception thrown in Thread[LWJGL Renderer Thread,5,main]
java.lang.OutOfMemoryError: Java heap space
at com.jme3.export.binary.BinaryImporter.readString(BinaryImporter.java:289)
at com.jme3.export.binary.BinaryImporter.load(BinaryImporter.java:182)
at com.jme3.export.binary.BinaryImporter.load(BinaryImporter.java:126)
at com.jme3.export.binary.BinaryImporter.load(BinaryImporter.java:110)
at com.jme3.asset.DesktopAssetManager.loadAsset(DesktopAssetManager.java:282)
at com.jme3.asset.DesktopAssetManager.loadModel(DesktopAssetManager.java:368)
at com.jme3.asset.DesktopAssetManager.loadModel(DesktopAssetManager.java:372)
at SimpleTreeTest.setupForester(SimpleTreeTest.java:203)
at SimpleTreeTest.simpleInitApp(SimpleTreeTest.java:174)
at com.jme3.app.SimpleApplication.initialize(SimpleApplication.java:225)
at com.jme3.system.lwjgl.LwjglAbstractDisplay.initInThread(LwjglAbstractDisplay.java:130)
at com.jme3.system.lwjgl.LwjglAbstractDisplay.run(LwjglAbstractDisplay.java:207)
at java.lang.Thread.run(Unknown Source)


So I read some topics relating this and I tried to change the default heap space size in my game by adding these options:

-Xms512m
-Xmx1024m
-XX:+UseParallelGC
-XX:PermSize=512M
-XX:MaxPermSize=1024M



But it doesn't fix it :s

Thank you.

is it the demo throwing these exceptions?

Yep. That’s really strange. I tried this on eclipse and with the sdk but nothing change.



EDIt: Ho and I forgot something, I can’t import the tree in the default test-data. So I downloaded the last one in the SVN. And with this one, the heap space issue appeared.





EDIT2: I cleaned all the project and resintalled the forester and tried again and it works. Can’t figure out why, but it works fine.



Thank you !

Note jme uses a lot of direct memory, thats not part of the heap.

@drweedy

You’re welcome.