Visual C ++:在发布模式下开始/不调试之间的区别 [英] Visual C++: Difference between Start with/without debugging in Release mode
问题描述
开始调试( F5 )与不调试启动( CTRL - F5 )当代码在发布模式中编译时
What is the difference between Start Debugging (F5) and Start without Debugging (CTRL-F5) when the code is compiled in Release mode?
我看到 CTRL - F5 比某些C ++代码的 F5 快10倍。如果我没有错,调试器将附加到 F5 的执行过程,而不是 CTRL - F5 。由于这是Release模式,编译后的代码没有任何调试信息。所以,如果我没有任何断点,执行时间应该是相同的,不是吗?!
I am seeing that CTRL-F5 is 10x faster than F5 for some C++ code. If I am not wrong, the debugger is attached to the executing process for F5 and it is not for CTRL-F5. Since this is Release mode, the compiled code does not have any debugging information. So, if I do not have any breakpoints, the execution times should be the same across the two, isn't it?!
(假设发布和调试模式是您创建新的Visual C ++项目时获得的典型配置。)
(Assume that the Release and Debug modes are the typical configurations you get when you create a new Visual C++ project.)
推荐答案
问题是Windows掉入特殊如果检测到您的程序在Debugger下运行,则调试堆。这似乎发生在操作系统级别,并且独立于您的编译的任何调试/发布模式设置。
The problem is that Windows drops in a special Debug Heap, if it detects that your program is running under a Debugger. This appears to happen at the OS level, and is independent of any Debug/Release mode settings for your compilation.
您可以通过设置环境来解决此功能变量:_NO_DEBUG_HEAP = 1
You can work around this 'feature' by setting an environment variable: _NO_DEBUG_HEAP=1
同样的问题一直在推动我一下;今天我发现以下内容,从这个帖子得出:
http://blogs.msdn.com/b/larryosterman/archive/2008/09/03/anatomy-of-a-heisenbug.aspx
This same issue has been driving me nuts for a while; today I found the following, from whence this post is derived: http://blogs.msdn.com/b/larryosterman/archive/2008/09/03/anatomy-of-a-heisenbug.aspx
这篇关于Visual C ++:在发布模式下开始/不调试之间的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!