Obviously I'm leaking memory somewhere (stacktrace below)… any idea where to begin looking? I'm creating many nodes per second, but once they are out of sight I'm making sure I'm doing the detachChild() call. This happens once the app has been running for a while.
I realize this is very obviously my problem, but any ideas/suggestions on where to begin looking?
java.lang.OutOfMemoryError: Direct buffer memory
at java.nio.Bits.reserveMemory(Bits.java:633)
at java.nio.DirectByteBuffer.<init>(DirectByteBuffer.java:95)
at java.nio.ByteBuffer.allocateDirect(ByteBuffer.java:288)
at com.jme.util.geom.BufferUtils.createFloatBuffer(Unknown Source)
at com.jme.util.geom.BufferUtils.createVector3Buffer(Unknown Source)
at com.jme.scene.shape.Capsule.recreateBuffers(Unknown Source)
at com.jme.scene.shape.Capsule.<init>(Unknown Source)
at name.changed.to.protect.innocent.EventBlob.draw(EventBlob.java:74)
at name.changed.to.protect.innocent.PhysicalGameState$1.call(PhysicalGameState.java:520)
at com.jme.util.GameTask.invoke(Unknown Source)
at com.jme.util.GameTaskQueue.execute(Unknown Source)
at com.jmex.game.StandardGame.update(Unknown Source)
at com.jmex.game.StandardGame.run(Unknown Source)
at java.lang.Thread.run(Thread.java:613)
Sounds like it is possible that the objects are still lingering somewhere. Can you profile it perhaps?
in the eclipse debugger, you can right click an reference and select 'all references …' maybe you see another object which still references your node.
Found the issue, thanks for the replies!
I'm using JFreeChart to create an AWT image, which in turn is converted to a com.jme.image.Image using TextureManager.loadImage(). I wrongly suspected JME, because of the "Direct Buffer Memory" error (never seen that particular OoM error), but adding the .flush() call to the AWT image seems to have alleviated the issue.
cheers
mike