Error: out of memory

Started by Melssj5, March 22, 2006, 03:29:37 AM

Previous topic - Next topic

EgonOlsen

Try this to narrow it down:

Start your app with "-Xms256m -Xmx256m" to set initial and max memory to the same value, so that no further memory allocation happens while running the program. Then call this method before and after doing...whatever...to see if this "whatever" maybe causes the problem.


public void memUsed() {
   Runtime rt=Runtime.getRuntime();
   System.out.println("Memory used: "+(rt.totalMemory()-rt.freeMemory()));
}

manumoi

hello, maybe you can show us your JPCT code if it s not copyrighted (or some parts only if too big).
Currently i have no clue on your problem.

Manu

Melssj5

It happens when creating a new World. I mean when calling to the constructor.

Memory used: 6209920
Exception in thread "main" java.lang.OutOfMemoryError: Java heap space

I have not posted in many time because I have had no time.
Nada por ahora

Melssj5

ok ok, I have found the problem that delayed me 3 weeks. Just was for a high value for Config.maxPolysVisible.

Is there a way to avoid the render dissapearing when its far without using Config.maxPolysVisible.
Nada por ahora

EgonOlsen

No, but may i ask which value you've assigned to Config.maxPolysVisible? I can't imagine a value that causes an out of memory and that is still reasonable to be managed by the engine. If you are using multiple worlds, you can give Config.shareVisibilityList a try, but be aware that this isn't always possible.

manumoi

Hello Mellsj
here is what i do to avoid rendering every polygons in my scene, I put the fog  at a distance smaller than the farPlane value,
My maxPolysVisible is 50000 and it works just fine. But as Egon said, i m surprised that your problem comes from this point


private void setupFog(){
       theWorld.setFogging(World.FOGGING_ENABLED);
       theWorld.setFogParameters(1000,0, 0, 0);
       Config.farPlane = 1020;
   }

Melssj5

I used a very high value, because I tried to use "real size", I mean in relative units, so the crafts are large and the maps are huge, I better use a scale  on all of them.
Nada por ahora