[SOLVED] Some problems while executing in release mode...

noisy_man

10-04-2008 23:08:49

Hi everyone !

I know, there are a lot of topics about why your program may not work in release mode whereas it works perfectly well in debug mode. Unfortunately, I am in this case and after several hours of reading topics, I'm asking for your help.

Here is the guilty code :

NxOgre::ShapeBlueprint* pShape = new NxOgre::CompoundShape(
new NxOgre::CubeShape(20.0f,20.0f,20.0f, "offset: 0 0 0"),
new NxOgre::CubeShape(1.0f,1.0f,1.0f, "offset: 0 0 0") );


// This is were the program crashes : the createBody() call
m_pMovementNode = pPhysicScene->createBody("SpaceShip;ork_rampager.mesh", pShape,
NxOgre::Pose(Ogre::Vector3(600,100,600)), "");


This works perfectly in debug mode, as I said, but crashes systematically in release. No compilation errors and no warnings by the way.

I've verified all the pointers and variables and everything is instantiated, especially those one :
NxOgre::Scene* pPhysicScene; // well instantiated
NxOgre::Body* m_pMovementNode; // set at NULL in the constructor of the class


The release project is also linked to the resources (and to ork_rampager.mesh).
Therefore I don't really understand why this createBody() doesn't work. It may be trivial but my brain refuses to give me the answer...

Thanks a lot by advance for your ideas !

betajaen

10-04-2008 23:41:34

The differences are quite subtle. The major difference and probably the number on reason of crashes or unexpected behavior including yours; is in Debug mode all variables and pointers are initialized to zero. In Release it is not and most likely some random piece of memory.

Most likely it's an uninitialized pointer being treated as an initialized pointer and some piece of code is using a variable or function.

Is there any way you can trace the error in your debugger?

noisy_man

11-04-2008 15:57:13

Thanks for your answer Betajaen.

The thing is I'm pretty sure I have initialized everything in this part of code... I also tested to "createBody" something else and somewhere else in my solution, in a part completely independent from this one, and I got the same crash when the program calls this method, in Release mode.

To trace the error, I basically print some MessageBox at strategic points to see where it crashes.

noisy_man

11-04-2008 16:38:46

I tried to "createActor" at the exact same place with the same parameters :

NxOgre::Actor* actor = pPhysicScene->createActor(spaceShipIdentifier, pShape,
NxOgre::Pose(Ogre::Vector3(600,100,600)), "");

m_pMovementNode = pPhysicScene->createBody(spaceShipIdentifier, pShape, NxOgre::Pose(Ogre::Vector3(600,100,600)), "");


The creation of actor works perfectly well. That makes me think it may be a "Body" problem, my variables and pointers don't seem to be guilty here.

noisy_man

11-04-2008 17:04:31

Ok my mistake guys...

I recompiled NxOgre and it works perfectly in Release mode. The guilty thing was old/wrong include paths in the NxOgre Release configuration...

Thanks anyway !