Works in Debug but not Release ?

Started by
3 comments, last by IkarusDowned 11 years, 3 months ago

Hi guys, I made a little physics engine and when I test a moving ball hitting a still ball the response is as expected when built in Debug mode, but when I build it in Release mode the response isn't correct; it doesn't really break or lock up, it just doesn't bounce the balls correctly at all.

What do you think it could be ?

I'm using VS2012 and C++

Thanks.

Advertisement

How does your timing/stepping work? It could just be that the release version is running faster, and thus running a more detailed simulation (more steps of a smaller size)?

Do you initialise all of your variables properly when they are first declared? Debug builds will often initialise variables to some sensible value for you, while release will not -- this could account for differences in behaviour.

If the problem occurs when balls are bouncing you might try stepping through your collision detection/response code with the debugger and examining the values of your variables to help track down the problem.

If neither of the above (faster time-step or uninitialised variables) are to blame could you describe the incorrect behaviour in more detail? What do you expect to happen, and what is actually happening instead? Are balls not bouncing at all, bouncing at the wrong angles, or something else...? smile.png

- Jason Astle-Adams

I would guess the same causes as jbadams, but if you are using multiple threads it could also be a race-condition that just happens a lot more often in release as in debug

What makes you think that multi-thread access is causing completely wacky results? Where are the multiple threads accessing shared memory? Ensure that your synchronization is set up there correctly.

This topic is closed to new replies.

Advertisement