Archived

This topic is now archived and is closed to further replies.

Russell

Release vs. Debug

Recommended Posts

When a program is compiled and linked for Debug, there is additional information ''mixed'' in to the executable, such as a symbol table (which is used by the debugger). Not only that but generally debug code is unoptimised and thus (generally) larger and slower.

Release executables are optimised and (sometimes) smaller, all textual symbolic tables are stripped out.



D.V.

Share this post


Link to post
Share on other sites
When debug mode is used, a large amount of extra code is added in (hidden at the beginning of functions) so that you can step through your code, and update it by breaking and applying code changes. also, debug mode does a few clever things for you, like setting uninitialised pointers to 0xCDCDC, which is great as you can recognise that it hasn''t been initialised, whereas in release mode an uninitialised pointer could be anything (whatever jargon is in the memory) so you can''t tell there is a problem. This inevitably makes the code slower and larger, and also makes the final *.exe UNUSABLE ON MOST COMPUTERS! As it links to the debug MFC, Runtime and Standard libraries (mfc42d.dll, msvcrtd.dll etc). most users have the ordinary versions of these libraries but not the release versions.

In release mode most macros like TRACE etc are removed, and all the step through code is removed. Unreferenced inline functions are removed, the code is fully compiled, unlike in most debug builds where you have larger, incremential compiles. release builds take longer, but create significantly smaller, faster executables (they do alot of clever things like reference counting as well). All of this can give massive speed increases in certain parts of the code.

overall, do a release build now and then to check for errors (like the common TRACE("Some Value: %i", &nInt++) where the ++ doesn''t happen- its in a macro that gets removed!) but use debug the rest of the time. NEVER give anyone or post a debug build as most users wont have the needed libraries.

sorry i rambled on a bit...

Share this post


Link to post
Share on other sites