difference between release and debug?

This is a discussion on difference between release and debug? within the Tech Board forums, part of the Community Boards category; Hi, What is the difference between release and debug when you compile? Is their any performance loss?? Why is the ...

  1. #1
    Registered User code2d's Avatar
    Join Date
    Nov 2006
    Location
    Canada
    Posts
    87

    difference between release and debug?

    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

  2. #2
    Mad OnionKnight's Avatar
    Join Date
    Jan 2005
    Location
    Umeň, Sweden
    Posts
    555
    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.

  3. #3
    CSharpener vart's Avatar
    Join Date
    Oct 2006
    Location
    Rishon LeZion, Israel
    Posts
    6,473
    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...
    The first 90% of a project takes 90% of the time,
    the last 10% takes the other 90% of the time.

  4. #4
    Captain Crash brewbuck's Avatar
    Join Date
    Mar 2007
    Location
    Portland, OR
    Posts
    7,235
    Quote Originally Posted by OnionKnight View Post
    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.
    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!

  5. #5
    Registered User code2d's Avatar
    Join Date
    Nov 2006
    Location
    Canada
    Posts
    87
    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 point
    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!
    I am very fair from professional at anything but I like to fell professional lol. I will test is release mode.

    thanks everyone for your great help.
    Compiler in use: MinGW

    OS: Windows ME

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. debug release conf problem
    By fighter92 in forum Game Programming
    Replies: 6
    Last Post: 03-20-2009, 04:39 PM
  2. makefiles - debug & release?
    By cpjust in forum C Programming
    Replies: 6
    Last Post: 10-26-2007, 04:00 PM
  3. Results in Debug and Release mode are different
    By jaro in forum C Programming
    Replies: 11
    Last Post: 05-27-2006, 11:08 AM
  4. debug to release modes
    By DavidP in forum Game Programming
    Replies: 5
    Last Post: 03-20-2003, 02:01 PM
  5. Differences in Debug and Release builds in MSVC
    By TravisS in forum C Programming
    Replies: 5
    Last Post: 06-19-2002, 10:40 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21