Hi,
What is the difference between release and debug when you compile? Is their any performance loss?? Why is the file size larger for debug??
-Thanks very much
Hi,
What is the difference between release and debug when you compile? Is their any performance loss?? Why is the file size larger for debug??
-Thanks very much
Compiler in use: MinGW
OS: Windows ME
Debug will compile your program with debugging symbols included and probably link to debug libraries instead of regular (which in turn differs because they have debugging symbols).
There is a slight performance loss with, and the file size gets larger as you noticed, when symbols are inserted.
If you try to debug a program and get to a point where your program crashes, say with a SEGFAULT you would normally only get limited information such as the name of the signal (SEGFAULT) and the contents of the processor registers.
If you have debugging symbols you can get a lot more helpful information, printing stuff like which source code file, inside which function it happened, the line number and the piece of code from that line.
debug version in most cases is compiled with optimisation disabled - this can greatly decrease performance.
In debug version variables can be initialized to zero - that can hide some random occured bugs in release version due to use of not-initialized vars.
Debug-version of malloc-like function can contain additional code to check the memory overrun on free.
Etc...
All problems in computer science can be solved by another level of indirection,
except for the problem of too many layers of indirection.
– David J. Wheeler
I want to add that on many runtime environments, it's possible to store the debug symbols in a separate file, so that the executable itself is smaller. Some debug modes embed the entire source tree directly into the binary, so that you can symbolically debug even when the source code is unavailable.
And as another aside... If you are releasing a professional product, it is NOT appropriate to do all your testing in debug mode, then recompile for release and release that binary. When you do that, you are releasing a binary which is NOT the same as the one you tested. Totally inappropriate. TEST THE RELEASE BUILD!
Ok, Thanks very much for explaining the reasoning in to choosing and not to choosing to compile in release and debug onionknight and vart. Brewbuck thanks for adding your pointI am very fair from professional at anything but I like to fell professional lol. I will test is release mode.And as another aside... If you are releasing a professional product, it is NOT appropriate to do all your testing in debug mode, then recompile for release and release that binary. When you do that, you are releasing a binary which is NOT the same as the one you tested. Totally inappropriate. TEST THE RELEASE BUILD!
thanks everyone for your great help.
Compiler in use: MinGW
OS: Windows ME