Weird behaviour of C++ destructors

前端 未结 8 1336
无人及你
无人及你 2020-12-17 03:29
#include 
#include 
using namespace std;

int main()
{
    vector< vector > dp(50000, vector(4, -1));
    c         


        
8条回答
  •  渐次进展
    2020-12-17 03:45

    Running a program with the debugger attached is always slower than without.

    This must be caused by VS hooking into the new/delete calls and doing more checking when attached - or the runtime library uses IsDebuggerPresent API and does things different in that case.

    You can easily try this from inside Visual Studio, start the program with Debug->Start Debugging or Debug->Start Without Debugging. Without debugging is like from command line, with exactly the same build configuration and executable.

提交回复
热议问题