What makes Debug different from Release?

Started by
19 comments, last by MJP 11 years, 3 months ago
I've been working on a project for awhile, and since I often send the executables to my friends to test, I tend to debug in Release mode. But I changed it back to Debug, and suddenly, a bunch of stuff is going wrong. How much different can it be that it pretty much destroys the data in my arrays? I'm using Microsoft Visual Studios 2010 Express, and when I switch to Debug from Release, at a certain point in my code, one of my two dimensional character arrays becomes half filled with a special character I use to test for collisions. I don't think it's necessary to show my code. I don't want to find where I specifically went wrong, just what makes Debug have this dramatic of a difference.
Advertisement
Debug mode enables lots of runtime checks.
You are somewhere trashing your arrays in release mode too, you are just "lucky" it hasn't shown as a bug yet.
When you're in Release mode you're sacrificing a lot of the runtime debugging Visual Studio does. In reality, however, your array is trashed in both Debug and Release mode. In Release mode you just can't tell because you're not debugging it! tongue.png

I would suggest going into Debug mode and stepping through your code to find where the problem is.
The majority of Internet Explorer users don't understand the concept of a browsing application, or that there are options.
They just see the big blue 'e' and think "Internet". The thought process usually does not get much deeper than that.

Worms are the weirdest and nicest creatures, and will one day prove themselves to the world.

I love the word Clicky
Just a little addition as I don't think much more can be added; It is always best to code + build in debug mode as this helps to iron out as many potential bugs your program has, before you set it to compile in Release. Release building is for (hence the name) deployment of your product to the client.

Just out of curiosity, did your VS set you to debugging in Release by default?

Regards,

Stitchs.
Also, keep an eye on unitialized variables. Debug mode will initialize variables that have not been explicitly initialized. Try compiling with the /RTCu flag set. See here: http://msdn.microsof...(v=vs.100).aspx for more information.
The difference between Debug and Release is whatever you define it to be.

"Debug" and "Release" are idioms of Visual Studio (and many other IDEs) -- they are the names of default build configurations generated for a solution/project/whatever-your-IDE-calls-it. Generally, the "debug" configuration does no optimization and enables a bunch of extra sanity checking and safety mechanisms that are not present in the "release" configuration (which also enables optimizations). Almost all of the options in the configuration correspond directly to parameters that can be given to the compiler and linker and any other tools used to actually build your project.

Every major IDE that supports these kinds of configurations also allows you to modify them as you need to, and usually to define additional ones as well.
In addition, "Debug" configurations most often compile full symbols into your executable, allowing you to easily debug runtime errors "just in time". There's also the option of creating external symbol database files for "Release" mode executables; however, optimized executables often reorder, alias, and/or eliminate code and data, and the symbols and code representation may not be accurate or readable anymore in that case.
Just out of curiosity, did your VS set you to debugging in Release by default?


No, I recently made a topic asking how to ship out a usable .exe, and they told me that I should build in release configuration. So instead of switching back all the time, I just got lazy and left it on Release. I have learned the error of my ways...

Thanks for the information everybody! If I have any other questions, I'll be sure to come back to this thread.

So I made sure I was always set to Debug mode after this thread, and so far I haven't had any errors. But then I switched to Release to test something out, and now everything has been thrown into chaos again. Things are being drawn out of order, my functions are being called with the wrong parameters-- everything is out of whack. If I can't trust Debug mode to get rid of these things, then how will I know nothign will go wrong with different computers and settings? Do I just have to keep switching in between them and making sure both modes run correctly? What is happening? Why is it so drastically different to run in Release mode?

In release mode, it creates a separate file (Called Release) for your project. You have to re-link Release Mode for it to work and include your Library DLL's and Files. I had your same problem with my first game (Pong :)!).

I'm a game programmer and computer science ninja !

Here's my 2D RPG-Ish Platformer Programmed in Python + Pygame, with a Custom Level Editor and Rendering System!

Here's my Custom IDE / Debugger Programmed in Pure Python and Designed from the Ground Up for Programming Education!

Want to ask about Python, Flask, wxPython, Pygame, C++, HTML5, CSS3, Javascript, jQuery, C++, Vimscript, SFML 1.6 / 2.0, or anything else? Recruiting for a game development team and need a passionate programmer? Just want to talk about programming? Email me here:

hobohm.business@gmail.com

or Personal-Message me on here !

This topic is closed to new replies.

Advertisement