plaisthos plaisthos - 1 month ago 9
C++ Question

Visual studio app running extremly slow with debug

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

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?

Answer

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 )

This can be done from inside Visual, too.

Now this is just a workaround, 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 ?