Fighting the OutOfMemoryError

there are quite a few bloks.

maybe you could merge them to bigger blocks ?

Hmm… You’re using SharedNode right?

Also take a look at this, it might help for what you’re doing even though it is a lonnnng thread:

I'm really new to this engine, so… nope, I"m not using SharedNode.  That topic looks very useful though, so thanks much!  Does anyone have any idea why that error appears though?

try with -Xmx1024m ?

Why is simple, jme is not able to clean up old geometry and other stuff lieing around completly. Mostly this wont be a problem though if u use the above command.

It may be a problem with garbage collecting (since I crash the gc if I try to run it manually), but since I'm not dereferencing my objects, they shouldn't be collected anyways.

With -Xmx1024m replacing my 256m, my program is only able to generate ~38,000 / 163,840 blocks, whereas the 256m allows my program to create ~80,000.

38071/163840 900522024
38072/163840 900522024
38073/163840 900522024
38074/163840 900522024
38075/163840 900522024
38076/163840 900522024
38077/163840 900522024
38078/163840 900522024
Exception in thread "main" java.lang.OutOfMemoryError
   at sun.misc.Unsafe.allocateMemory(Native Method)
   at java.nio.DirectByteBuffer.<init>(Unknown Source)
   at java.nio.ByteBuffer.allocateDirect(Unknown Source)
   at com.jme.util.geom.BufferUtils.createFloatBuffer(
   at com.jme.util.geom.BufferUtils.createVector2Buffer(
   at com.jme.scene.shape.Box.duUpdateGeometryTextures(
   at com.jme.scene.shape.AbstractBox.updateGeometry(
   at com.jme.scene.shape.AbstractBox.updateGeometry(
   at com.jme.scene.shape.Box.<init>(
   at environment.Block.<init>(
   at environment.World.renderHeightMap(
   at environment.World.<init>(
   at main.Entry.main(
Mar 31, 2010 6:54:56 AM uncaughtException
SEVERE: Main game loop broken by uncaught exception
   at java.lang.ClassLoader.defineClass1(Native Method)
   at java.lang.ClassLoader.defineClassCond(Unknown Source)
   at java.lang.ClassLoader.defineClass(Unknown Source)
   at Source)
   at Source)
   at$000(Unknown Source)
   at$ Source)
   at Method)
   at Source)
   at java.lang.ClassLoader.loadClass(Unknown Source)
   at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
   at java.lang.ClassLoader.loadClass(Unknown Source)
   at org.lwjgl.opengl.WindowsKeyboard.handleKey(
   at org.lwjgl.opengl.WindowsDisplay.handleKeyButton(
   at org.lwjgl.opengl.WindowsDisplay.doHandleMessage(
   at org.lwjgl.opengl.WindowsDisplay.handleMessage(
   at org.lwjgl.opengl.WindowsDisplay.nUpdate(Native Method)
   at org.lwjgl.opengl.WindowsDisplay.update(
   at org.lwjgl.opengl.Display.processMessages(
   at org.lwjgl.opengl.Display.update(
   at com.jme.renderer.lwjgl.LWJGLRenderer.displayBackBuffer(
   at Source)

I forgot to mention earlier, but this code only runs one time. At this point I am simply generating the world that I will later modify. My problem is running out of memory when the JVM thinks it still has memory left. This last run (with the 1024m) is a good example of the problem, since at the time of crash, Runtime.getRuntime().freeMemory() = 900522024 (bytes).

ever thought about using sharednodes sharedmeshs?

You are  runing out of direct memory, ther is another command to increas that xmx Xms somewhat like look in the java doc. Alternativ but slower, there is a way to disable the bytebuffer to use direct memory and let them use heap insteand when I rmember right.