VM crash workaround!

I’ve recently discovered a nice workaround for the native VM crashes that seem to plague odejava when large numbers of objects are added to the system. By adjusting the java thread stack size parameter (-Xss), one can dramatically increase the runtime stability of odejava.

I am running Windows XP on a p4 with 512M ram and a GeForce4 4600.

With -Xss512k (the default), I can add 762 spheres to the system without a native crash.
With -Xss1M, I can add 1517 spheres.
With -Xss2M, I can add 2663 spheres.

And explanation of the -Xss option can be found here:
http://java.sun.com/j2se/1.3/docs/tooldocs/solaris/java.html
(old Java version but best description).

I hope this helps! :smiley:

Thats all fair and square…however

try adding a tower which is 15 blocks high and each “level” has 3 blocks going horizontally across the x axis and another going in the direction (either z or y, whichever…).

Heck, il even supply you the code:


private void initFacingBlocks() {
            for (int i = 0; i < NUM_OF_ROWS; i++) {
                  for (int j = 0; j < 3; j++) {                        
                        TextureState boxTS = TextureLoader.loadTexture("jmetest/data/texture/crate.png");
                        
                        Box box = new Box("Facing Box " + i + ", " + j, new Vector3f(),
                                    6, 2, 2);
                        box.setModelBound(new OrientedBoundingBox());
                        box.updateModelBound();
                        box.getLocalTranslation().x = 0;
                        box.getLocalTranslation().y = i * 10f;
                        box.getLocalTranslation().z = j * 4.2f - 4.2f;
                        box.setRenderState(boxTS);
                        towerNode.attachChild(box);
                        
                        SimplePhysicsObject obj = new SimplePhysicsObject(box, 20f);
                  }
            }
      }

      private void initLeftBlocks() {
            for (int i = 0; i < NUM_OF_ROWS; i++) {
                  for (int j = 0; j < 3; j++) {
                        TextureState boxTS = TextureLoader.loadTexture("jmetest/data/texture/crate.png");
                        
                        Box box = new Box("Left Box " + i + ", " + j, new Vector3f(),
                                    2, 2, 6);
                        box.setModelBound(new OrientedBoundingBox());
                        box.updateModelBound();
                        box.getLocalTranslation().x = j * 4.2f - 4.2f;
                        box.getLocalTranslation().y = 5f + (i * 10f);
                        box.getLocalTranslation().z = 0;
                        box.setRenderState(boxTS);
                        towerNode.attachChild(box);
                        
                        SimplePhysicsObject obj = new SimplePhysicsObject(box, 20f);
                  }
            }
      }

Set the NUM_OF_ROWS to 8, it works fine…10, works fine…however, when u go wild and put 15, it works…as long as they dont all have contact!

As soon as the top most blocks start touching…kabooom:

Thats all ODEJava says…It seems to be its nothing to do with the java stack, but rather with an internal limit somehow…

Ofcourse increasing the stack size doesn’t help. It would only help on adding objects, not contact…

Is there a set number of contacts that can occur at any one given time?

DP

Ugg… you could try World.setStepInteractions(int i). I’m working on another (possibly related) native crash at the moment. I’ll post if I come up with anything.

ODE does have stack limits. I think it is possible to increase them at compile time, at least for the Windows DLL. What platforms are you testing on?

I trust everyone here is using the DEBUG version? It is much more helpful at solving nasty (and they are) native crashes.

Will.

I am using windows for testing…but i dont want to limit to windows since i am using Java! 8)

I am using the release version…il d’ld the debug now.

DP

I am also using Windows and do not want to be limited to Windows either :smiley: I didn’t see a debug native library on the download page. Where can it be downloaded from?

I wasn’t suggesting only developing for Windows :), I use OS X personally but test occasionally on Windows. Using *NIX debug ODE libraries produces handy debug messages to stdout, the Windows DLL has message boxes I think.

Grab the latest natives here: https://odejava.dev.java.net/servlets/ProjectDocumentList?folderID=2191&expandFolder=2191&folderID=0 You should find that each download has both debug and release versions.

Don’t forget if you update the natives, the .jars need updating as well. This version is the latest: https://odejava.dev.java.net/servlets/ProjectDocumentList?folderID=2192&expandFolder=2192&folderID=2191

Will.

Got it! Thanks!