Do you know the difference between debug and release in vs? debugrelease

Source: Internet
Author: User

Do you know the difference between debug and release in vs? debugrelease

In Visual Studio, there are two modes for generating an application: Debug and Release. How can we choose between them?

 

I. Differences between debug and release in

 

1. Debug is usually called a Debug version. It contains debugging information without any optimization, which facilitates programmers to Debug programs.

2. Release is called a Release version. It is often optimized to optimize the code size and running speed, so that users can use it well.

3. the debug program is generally slower than the release program, especially for video processing.

4. Only DEBUG programs can set breakpoint, single-step execution, and DEBUG output statements using TRACE/ASSERT. Realbench does not contain any debugging information

5. Debug in Debug mode and Release mode. Debug mode consumes more memory, so it runs slowly.

In practice, you should deploy the application generated in the Release mode to the server.

 

 

Ii. Differences between debug and release

 

Assume that there is such a simple piece of code that calls Methods M1 and M1 in the main program to call the M2 method, M2 to call the M3 method, and M3 to throw an exception.

C # code Replication
      class Program
    {        static void Main(string[] args)        {            M1();            Console.ReadKey();        }        static void M1()        {            M2();        }        static void M2()        {            M3();        }        static void M3()        {            throw new Exception("error");        }    }

 

1. Select "Debug" Mode

Place the breakpoint on the Console. ReadKey (); line of code. Click "Debug> WINDOW> call stack" to display the "call stack" window information, as shown below:

 

2. Select the "Release" mode and debug it. The following figure is displayed::

 

 


Differences between DEBUG and Release

DEBU is a debugging version. It can be said that the system is still under development and the Release is a released version. The main difference that the system can use for users is that the information generated during runtime is different and the running performance is different.

In vs2010, both debug and release can be broken into the following debugging programs. Why are there two compilation modes?

First, there are two compilation modes: debug and release memory allocation, optimization, and keyword processing. The debug information is complete, and the release lacks much of the above information.
What you describe is not accurate. release only has some locations for breakpoint debugging. Unlike debug, debug can be debugged anywhere.
This is because debugging is not optimized during compilation. Every command can be mapped to the code and can be debugged,
Because of the performance optimization, the commands cannot be fully mapped to the code. By accident, the correct part can be called, and other parts cannot be called.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.