Click to See Complete Forum and Search --> : Debug and Release configurations
kenrus
October 1st, 2008, 10:55 AM
I do not do much development in C# and I am still learning a lot. I am confused about what is going on with the final output of my compile.
Primarily: Why are the executables compiled under the Release configuration and the Debug configuration the same size?
But also: Why are the executables in multiple locations?
bin\debug\myexe.exe
bin\release\myexe.exe
obj\debug\myexe.exe
obj\release\myexe.exe
So, which one should I distribute to the user and why are they all the same size? My previous experience leads me to believe that the executable compiled with the debug configuration should be larger than the executable compiled with the release configuration.
Thanks,
Kendall
MMH
October 1st, 2008, 11:51 AM
Primarily: Why are the executables compiled under the Release configuration and the Debug configuration the same size?
Size of the executable or the compiled output doesn't depened upon the compiler configuration. One difference between the two configurations is that; while in release mode, the debug information is not written to the bin directory. You can verify that the files with .pdb extension are created in debug mode only.
But also: Why are the executables in multiple locations?
bin\debug\myexe.exe
bin\release\myexe.exe
obj\debug\myexe.exe
obj\release\myexe.exe
All the files in the "obj" are used by compiler as a temporary dump. And so you can't even change the location of "obj" directory (as far as i know).
So, which one should I distribute to the user and why are they all the same size? My previous experience leads me to believe that the executable compiled with the debug configuration should be larger than the executable compiled with the release configuration.
Now it is quite obvious that you should use the files from the release directory. (bin\release\myexe.exe)
But this is still not recommended for distribution. Always insist on creating a setup.
I hope this helps...
MMH.
Mutant_Fruit
October 1st, 2008, 06:37 PM
If you work with a large project, the debug and release builds are substantially different in size. Release being the smaller of the two. The exact difference depends on the project itself, but i'd say 20% smaller wouldn't be be an unreasonable estimate.
boudino
October 2nd, 2008, 02:07 AM
One mahor difference is that in relase mode, there is not defined DEBUG compilation symbol, which affects behavior of methods annotated with Conditional attribute.
Also, in release mode, some optimization maybe done, like striping code which will never run, inlining some methods, etc.
kenrus
October 2nd, 2008, 03:28 PM
Thanks everyone, I appreciate the information.
TheCPUWizard
October 2nd, 2008, 04:00 PM
When will people ever learn.that "DEBUG" and "RELEASE" are just two configurations (combinations of compiler,library and linker settings) that are created by default.
(nearly) EVERY statement here, is in accurate. You can turn on debug information for the release configuration, you can turn it off for the debug configuration. You can specifiy identical output directories, or radically different ones. EVERYTHING is configurable, you can completely swap the functionallity of the two build configurations.
People have to start thinking in terms of the individual (compiler, linker, etc) settings and their inter-relationship, and STOP treating Build Configurations (complex, editable, combinations) as anything other than a quick way of maintaining different sets of settings for what occurs when you hit Build (or Batch Build to create multiple configurations at the same time).
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.