Sign in to follow this  

Program works in debug but not release

This topic is 399 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

Hi

 

I have made a real time raytracer that renders a plane, a bouncing sphere and allows motion of the camera via mouse and keys.

 

I am using visual studio 2015. When i click the green debug play button, everything works fine.

 

When i build a release or debug version, i double click the exe file, my window opens, the sky and plane renders but the ball is nowhere to be seen and the camera controls dont work.

 

I am using opengl to render a texture to a quad, opencl for the actual raytracers and sdl2 for inut and window. And using C

 

Thanks for any tips

Edited by BadEggGames

Share this post


Link to post
Share on other sites

This sounds as if some Visual Studio magic happens during debug play that dosent happen in stand alone mode. Maybe something related to the VisualStudio service running your program when you hit the play button, path mismatches (are you loading something from hdd?) or you get internal errors that arent recognized.

 

This is very difficult to say without seeing any source, you might need to debug your program without breakpoints but state checks e.g. glGetError(), GetLastError() (winapi), and whatever the OpenCl equivalent is. You should also check for nullpointers and whatever could struggle in your program.

 

Check for Windows Defender, Firewall, third party Software first and try to run your program as Admin.

If nothing helps at all go for procmon.exe to see what your program calls in the background while running

Edited by Shaarigan

Share this post


Link to post
Share on other sites

The problem was that the dubugger was initializing an array with all zeros but the release version wasnt. Forgot the debugger helped you out a bit

 

Inconsistent behavior between debug and release builds is pretty rare (when everything is initialized correctly, that is <g>).

 

But they are not totally unheard of. About once every 5 years or so.    For that reason, I develop in release mode only, at the cost of no debugger - not necessarily recommended for everyone.

 

I also fire up the task manager as soon as i logon, and kill all possible background processes.   This helps insure background processes don't interfere with development.

 

 

Odd, I though debug was supposed to exactly replicate release behavior.   In that case, zeroing vs not zeroing memory is a definite bug, not a "feature".

 

Or did they change the definition of debug behavior?

Share this post


Link to post
Share on other sites

Debug builds tend to initialize variables to zero, it's the number one thing I'd check for if something works in debug but not release.  Also, up your warnings level, turn them into compile errors, and it will catch that and prevent you from pulling your hair out.  And make you a better coder in the process.

Share this post


Link to post
Share on other sites

Thanks

 

The problem was that the dubugger was initializing an array with all zeros but the release version wasnt. Forgot the debugger helped you out a bit :P

 

Thanks

 

That was going to be my guess, debug tends to clear memory for created vars etc and release does not. Great gotcha that caught me in the past when working in C

Share this post


Link to post
Share on other sites

This topic is 399 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