SDK error

java.lang.OutOfMemoryError: Direct buffer memory
	at java.base/java.nio.Bits.reserveMemory(Bits.java:175)
	at java.base/java.nio.DirectByteBuffer.<init>(DirectByteBuffer.java:118)
	at java.base/java.nio.ByteBuffer.allocateDirect(ByteBuffer.java:317)
	at com.jme3.util.ReflectionAllocator.allocate(ReflectionAllocator.java:172)
	at com.jme3.util.BufferUtils.createByteBuffer(BufferUtils.java:995)
	at com.jme3.texture.plugins.AWTLoader.load(AWTLoader.java:122)
	at com.jme3.texture.plugins.AWTLoader.load(AWTLoader.java:184)
	at com.jme3.texture.plugins.AWTLoader.load(AWTLoader.java:193)
	at com.jme3.asset.DesktopAssetManager.loadLocatedAsset(DesktopAssetManager.java:272)
	at com.jme3.asset.DesktopAssetManager.loadAsset(DesktopAssetManager.java:388)
	at com.jme3.asset.DesktopAssetManager.loadTexture(DesktopAssetManager.java:407)
	at com.jme3.material.plugins.J3MLoader.parseTextureType(J3MLoader.java:281)
	at com.jme3.material.plugins.J3MLoader.readValue(J3MLoader.java:304)
	at com.jme3.material.plugins.J3MLoader.readValueParam(J3MLoader.java:425)
	at com.jme3.material.plugins.J3MLoader.readExtendingMaterialParams(J3MLoader.java:441)
	at com.jme3.material.plugins.J3MLoader.loadFromRoot(J3MLoader.java:771)
	at com.jme3.material.plugins.J3MLoader.load(J3MLoader.java:801)
	at com.jme3.asset.DesktopAssetManager.loadLocatedAsset(DesktopAssetManager.java:272)
	at com.jme3.asset.DesktopAssetManager.loadAsset(DesktopAssetManager.java:388)
	at com.jme3.asset.DesktopAssetManager.loadMaterial(DesktopAssetManager.java:412)
	at com.jme3.scene.Geometry.read(Geometry.java:730)
	at com.jme3.export.binary.BinaryImporter.readObject(BinaryImporter.java:345)
	at com.jme3.export.binary.BinaryInputCapsule.resolveIDs(BinaryInputCapsule.java:510)
	at com.jme3.export.binary.BinaryInputCapsule.readSavableArray(BinaryInputCapsule.java:498)
	at com.jme3.export.binary.BinaryInputCapsule.readSavableArrayList(BinaryInputCapsule.java:616)
	at com.jme3.scene.Node.read(Node.java:768)
	at com.jme3.export.binary.BinaryImporter.readObject(BinaryImporter.java:345)
	at com.jme3.export.binary.BinaryImporter.load(BinaryImporter.java:245)
	at com.jme3.export.binary.BinaryImporter.load(BinaryImporter.java:128)
	at com.jme3.export.binary.BinaryImporter.load(BinaryImporter.java:112)
	at com.jme3.export.binary.BinaryLoader.load(BinaryLoader.java:36)
	at com.jme3.asset.DesktopAssetManager.loadLocatedAsset(DesktopAssetManager.java:272)
	at com.jme3.asset.DesktopAssetManager.loadAsset(DesktopAssetManager.java:388)
	at com.jme3.asset.DesktopAssetManager.loadModel(DesktopAssetManager.java:439)
	at com.jme3.gde.core.assets.SpatialAssetDataObject.loadAsset(SpatialAssetDataObject.java:94)
	at com.jme3.gde.scenecomposer.OpenSceneComposer$1.run(OpenSceneComposer.java:37)
	at java.base/java.lang.Thread.run(Thread.java:829)
java.lang.OutOfMemoryError: Direct buffer memory
	at java.base/java.nio.Bits.reserveMemory(Bits.java:175)
	at java.base/java.nio.DirectByteBuffer.<init>(DirectByteBuffer.java:118)
	at java.base/java.nio.ByteBuffer.allocateDirect(ByteBuffer.java:317)
	at com.jme3.util.ReflectionAllocator.allocate(ReflectionAllocator.java:172)
	at com.jme3.util.BufferUtils.createByteBuffer(BufferUtils.java:995)
	at com.jme3.texture.plugins.AWTLoader.load(AWTLoader.java:122)
	at com.jme3.texture.plugins.AWTLoader.load(AWTLoader.java:184)
	at com.jme3.texture.plugins.AWTLoader.load(AWTLoader.java:193)
	at com.jme3.asset.DesktopAssetManager.loadLocatedAsset(DesktopAssetManager.java:272)
	at com.jme3.asset.DesktopAssetManager.loadAsset(DesktopAssetManager.java:388)
	at com.jme3.asset.DesktopAssetManager.loadTexture(DesktopAssetManager.java:407)
	at com.jme3.texture.Texture.read(Texture.java:623)
	at com.jme3.texture.Texture2D.read(Texture2D.java:218)
	at com.jme3.export.binary.BinaryImporter.readObject(BinaryImporter.java:345)
	at com.jme3.export.binary.BinaryInputCapsule.readSavable(BinaryInputCapsule.java:483)
	at com.jme3.material.MatParam.read(MatParam.java:380)
	at com.jme3.material.MatParamTexture.read(MatParamTexture.java:105)
	at com.jme3.export.binary.BinaryImporter.readObject(BinaryImporter.java:345)
	at com.jme3.export.binary.BinaryInputCapsule.resolveIDs(BinaryInputCapsule.java:510)
	at com.jme3.export.binary.BinaryInputCapsule.readStringSavableMap(BinaryInputCapsule.java:700)
	at com.jme3.material.Material.read(Material.java:1079)
	at com.jme3.export.binary.BinaryImporter.readObject(BinaryImporter.java:345)
	at com.jme3.export.binary.BinaryInputCapsule.readSavable(BinaryInputCapsule.java:483)
	at com.jme3.scene.Geometry.read(Geometry.java:739)
	at com.jme3.export.binary.BinaryImporter.readObject(BinaryImporter.java:345)
	at com.jme3.export.binary.BinaryInputCapsule.resolveIDs(BinaryInputCapsule.java:510)
	at com.jme3.export.binary.BinaryInputCapsule.readSavableArray(BinaryInputCapsule.java:498)
	at com.jme3.export.binary.BinaryInputCapsule.readSavableArrayList(BinaryInputCapsule.java:616)
	at com.jme3.scene.Node.read(Node.java:768)
	at com.jme3.export.binary.BinaryImporter.readObject(BinaryImporter.java:345)
	at com.jme3.export.binary.BinaryImporter.load(BinaryImporter.java:245)
	at com.jme3.export.binary.BinaryImporter.load(BinaryImporter.java:128)
	at com.jme3.export.binary.BinaryImporter.load(BinaryImporter.java:112)
	at com.jme3.export.binary.BinaryLoader.load(BinaryLoader.java:36)
	at com.jme3.asset.DesktopAssetManager.loadLocatedAsset(DesktopAssetManager.java:272)
	at com.jme3.asset.DesktopAssetManager.loadAsset(DesktopAssetManager.java:388)
	at com.jme3.asset.DesktopAssetManager.loadModel(DesktopAssetManager.java:439)
	at com.jme3.gde.core.assets.SpatialAssetDataObject.loadAsset(SpatialAssetDataObject.java:94)
	at com.jme3.gde.scenecomposer.OpenSceneComposer$1.run(OpenSceneComposer.java:37)
	at java.base/java.lang.Thread.run(Thread.java:829)

Try to increase -XX:MaxDirectMemorySize. I think there should be a config file in SDK for setting it. You can also google for “How to increase MaxDirectMemorySize in Netbeans IDE” as JME SDK is based on Netbeans IDE.

3 Likes

Thank you for your reply and help

1 Like

Seems you are trying to open a very tough asset…for that purpose, you can extend the jvm heap memory through this file:
https://docs.oracle.com/cd/E19509-01/821-0449/inst_increase_heap_size_t/

The command option is a java runtime option:

-J-Xmx128m

You have to insert it within the netbeans_default_options attribute:

netbeans_default_options="-J-Xmx${MEMORY}"

Replace the MEMORY with what appropriate with you.

you will find the file @Ali_RS is telling you about at jmonkeyplatform/etc/jmonkeyplatform.conf:

image

3 Likes