OutOfMemory while creating a TerrainBlock

From the below code, I get an OoM error.  The image is 2048x2048, but, should that really cause that much problems?  Or an I just doing something wrong?




package map;

import javax.swing.ImageIcon;

import com.jme.bounding.BoundingBox;
import com.jme.math.Vector3f;
import com.jme.scene.Node;
import com.jmex.terrain.TerrainBlock;
import com.jmex.terrain.util.ImageBasedHeightMap;

public class BeginingMap extends Node
{
   Node root = this;
   
   public BeginingMap()
   {
      buildTerrain();
   }
   
   public void buildTerrain()
   {
      ImageBasedHeightMap hm = new ImageBasedHeightMap(new ImageIcon(BeginingMap.class.getResource("/resources/heightmaps/beginmap.png")).getImage());
      TerrainBlock tb = new TerrainBlock("Terrain", hm.getSize(), new Vector3f(1, 1, 1), hm.getHeightMap(), new Vector3f(0, 0, 0));
      
      tb.setModelBound(new BoundingBox());
      tb.updateModelBound();
      
      root.attachChild(tb);
   }
   
   public static void main(String args[])
   {
      new BeginingMap();
   }
}

ummm, that's over 4,000,000 verts (thats pretty high)…



You could try adding the VM-arg: -Xmx256m

But I don't know how much that will help…