Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

debug vs. release dll size

Why in cpp a dll in debug mode is X10 bigger than release while in .Net they are almost the same size?

like image 587
Yaron Naveh Avatar asked Sep 22 '26 00:09

Yaron Naveh


1 Answers

To Debug a C++ program alot of extra information has to be kept in the DLL so the debugger can find out about the code at run-time. C++ has no run-time requirement to be able to inspect the code unlike C# which allows for extensive run-time inspection also known as reflection. This information is there in C# whether using debug or release mode.

Additionally C++ is usually compiled directly to machine code in release mode the objective of the compiler is to optimized the code as much as possible, eg. remove any and all extraneous information and code. In C# the compiler compiles to a pseudo code which is just in time compiled as required. This code keeps much of what is required for debugging regardless if it is release or debug that you are building. So much so that it is possible to write a de-compiler to give you the code back from a run-time assembly.

like image 151
AnthonyLambert Avatar answered Sep 23 '26 14:09

AnthonyLambert