Visual Studio应用程序通过调试运行非常慢 [英] Visual Studio application running extremely slow with debug

查看:689
本文介绍了Visual Studio应用程序通过调试运行非常慢的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个本机C ++程序,当使用 Debug ( F5 )启动时,运行速度慢20倍以上,但使用无调试启动时,运行速度正常( Ctrl + F5 ).

I have a native C++ program which runs more than 20 times slower when started with Debug (F5), but runs at normal speed when using start without debug (Ctrl + F5).

我使用调试版本还是发布版本都没有关系.另外,如果我使用WinDbg,该程序的速度会慢很多.

It does not matter whether I use a debug or release build. Also if I use WinDbg the program is a magnitude slower.

我是否确实选择了错误的设置?

Is there some setting I did choose wrong or something?

推荐答案

将_NO_DEBUG_HEAP环境变量设置为1(如

Set the _NO_DEBUG_HEAP environment variable to 1 (as seen on http://preshing.com/20110717/the-windows-heap-is-slow-when-launched-from-the-debugger).

这也可以在Visual Studio内部完成.

This can be done from inside Visual Studio, too.

现在这只是一个变通办法,我很好奇知道如何重构遭受此类问题困扰的程序.您是否有很多std :: map,shared_ptr或其他任何大的间接访问?

Now this is just a workaround, and I'm curious to know how to refactor a program which suffers from this kind of problem. Do you have many std::map's, shared_ptr, or any other big indirections by any chance?

这篇关于Visual Studio应用程序通过调试运行非常慢的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆