CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com

View Poll Results: is UNIX better than WinNT

Voters
7. You may not vote on this poll
  • yes

    2 28.57%
  • no

    1 14.29%
  • can't say

    1 14.29%
  • same

    3 42.86%
Results 1 to 3 of 3
  1. #1
    Join Date
    Apr 2002
    Location
    India - bangalore
    Posts
    53

    Exclamation diff between debug version and release version in code generation

    hi,

    I like to know the difference between executable generated in debug mode and to that of Release mode under VC++ environment. The file size in debug mode is more than file size in release size.
    Actually optimisation of code occurs in release mode. But by seeing the file size diff i can't think that much optimisation occurs. I guess the code generated in debug mode contains debug information. if this is the case, is it required to embed the debug info into the executable. Please come up with the full details which takes major role in code generation.

  2. #2
    John E is offline Elite Member Power Poster
    Join Date
    Apr 2001
    Location
    Manchester, England
    Posts
    4,867
    There are several differences between the two versions but the big increase in size is because the debug version contains special information to allow your debugger to step through the code. All your source code is converted into machine code because that's the only way your program can run on its target processor. In the debug version though, each small block of machine code contains references that enable your debugger to locate the actual line of source code that originally generated the machine code. This is why you can 'step through' programs and set break points etc in debug mode but not in release mode. This debugging information is huge.

    Another important difference is that all variables (in debug mode) are 'cushioned' by a few bytes which are checked by the debugger to make sure your program isn't writing into memory it doesn't own. If it is, you'll see a warning in your output window beginning with the word "Damage". This is usually displayed after the program terminates. Again, this 'cushioning' takes up extra bytes in your program.

  3. #3
    Join Date
    Sep 2002
    Posts
    70
    Also realize that if you optimize for speed vs. size, the result will usually be longer due to loop unrolling and inlined code, etc.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured