Preface
always know that there is a debug version and Relase version, has not been particularly clear about what the nature of the difference between the two, so do a comparison here, here to Hellworld code for example.
Code:
#include <Windows.h>
#include <tchar.h>
int _tmain(int argc, TCHAR *argv[]){
MessageBox(NULL, L"Have a test", L"OK", MB_OK);
return 0;
}
One, sizeThere is a substantial difference between the size of the two, and the size of the two is very different. You can see that the debug version is 5 times times faster than the release version, so what is the result that release is so much smaller than the Dbueg version?
- The debug version, also known as the Debug version, compiles the result with debug information and does nothing to optimize the application to provide the developer with a powerful, virtual debugging capability
- Release version, often also known as release version, does not save debug information, and has been a variety of optimizations to achieve the minimum and optimal speed of aunt.
A lot of friends want to ask again, so debugging information is what information to write it? What did the release do to optimize and optimize?
For example, when you debug your code, you get the next breakpoint, so how does the debugger know you have a breakpoint? That is, our debugging information will tell the debugger. In peacetime debugging we will also go to see if the value of the variable is as much as we expected, here is the debugger through debugging information to find the value of the variable and show it. To know more about debugging information just, you can look at the compiler principle related things, the façade of the more detailed
- release optimization
- The first should be debugging information, release does not contain debug information
- Optimization of variables, debug version If the variable is not initialized, the variable is automatically initialized to 0XCC, and the dynamically allocated memory is assigned a value of 0XCD. The release version does not initialize the variable, and it does not handle the data in memory when the memory is dynamically allocated
- memory allocation length processing, debug version allocation bytes in 32bytes, release is in 8bytes units. For example, the definition of int num[4], in the debug version can allocate to the memory length is 32byte, but in the release version can only be assigned to 16byte nbsp;
- release version for frequently used variables automatically turn them into register variables to speed up the program
- The compiled program, the debug version contains the source code to facilitate debugging, But release does not contain.
debugging information about debug and release optimization There are a lot of places do not talk about, here only to say a ballpark, let everyone probably know the concept of these two, determine what the two exactly do.
second, the festivalas shown, the debug version has two more sections than the release version, and the. TEXTBSS and. Idata Two sections Let's talk about these two knots .
- . TEXTBSS is an incremental link and a dynamic build service, disabling incremental linking causes the dynamic compilation feature to be unusable, no dynamic link is used to load the function, and the release version is optimized
- . idata contains the function technical bureau information of other foreign DLLs, that is, the input table, merging the idata chunks into another chunk is now a convention, typically. Rdata chunks, by default, the connector will only be created when you create a known line file in your release mode. idata Merge to another area
Iii. Ida anti-compilation
- Release version is relatively concise, is directly a function call no additional extraneous information
- The debug version is a lot more complex, with a lot of debugger information and some system function calls. A simple MessageBoxW function call that appears at multiple function layer layers called
Summary to this
Null
Debug version and Relase version comparison