Sign in to follow this  

Release and Debug

This topic is 3740 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Okay so I am getting this problem with running my pool game in debug mode. The problem is in the collision detection. I setup a collision between two pool balls and run the program. In debug mode they bounce off each other just fine but when I switch to release the ball goes straight through. I set it so it will update the scene by the same increment of time regardless of how it's run. I can't think of why the Release would produce the result. Any Ideas?

Share this post


Link to post
Share on other sites
Most bugs which occur in release builds but not debug are caused by uninitialised variables (debug builds usually fill these with known values). If you know which classes are causing the unexpected result then I'd have a check that all the member variables are initialised to something sensible in the contructor. If you're not already, then compile with the warnings turned up as high as possible and pay attention to them, you might find your problem has already been spotted by the compiler.

Other than that, you can still run a release build via the debugger (although things like your watch window might not give you the same amount of info as in debug, and single-stepping may be different due to inlined functions). Even with these quirks you should still be able to narrow it down to the particular function which is failing.

Edit: the other main cause of release-only bugs is usually a memory overwrite of some sorts, which can be a pain to track down. Debug builds often pad out memory allocations (such as arrays) with blank data so accidentally accessing an out of bounds index will just scribble over unused data in debug, but overwrite other variables in a release build. Check your array indices and any pointer arithmatic to make sure you're not writing over something you shouldn't.

Share this post


Link to post
Share on other sites
Another release/debug discrepancy that caught me a-cropper recently is order of creation of global variables. I'm not sure if it was a consequence of something more fundamental - I didn't investigate - but I found that a class whose constructor depended on a global variable having been initialised (in a different compilation unit) would fail only in my release build.

Not meaning to hijack the thread, but is anyone familiar with this phenomenon, or am I simply analysing symptoms of a deeper ailment?

Admiral

Share this post


Link to post
Share on other sites

This topic is 3740 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this