Program works in debug but not release

Started by
5 comments, last by WozNZ 7 years, 5 months ago

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

Advertisement

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

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

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?

Norm Barrows

Rockland Software Productions

"Building PC games since 1989"

rocklandsoftware.net

PLAY CAVEMAN NOW!

http://rocklandsoftware.net/beta.php

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.

This is a good lesson to always initialize your vars (I.e. in your constructor, initializer list). Same goes for pointers, which will be null in debug but not (always) in release.

Crealysm game & engine development: http://www.crealysm.com

Looking for a passionate, disciplined and structured producer? PM me

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

This topic is closed to new replies.

Advertisement