Weird behaviour of C++ destructors

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

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


        
8条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-17 04:08

    The debug heap automatically gets enabled when you start your program in the debugger, as opposed to attaching to an already-running program with the debugger.

    The book Advanced Windows Debugging by Mario Hewardt and Daniel Pravat has some decent information about the Windows heap, and it turns out that the chapter on heaps is up on the web site as a sample chapter.

    Page 281 has a sidebar about "Attaching Versus Starting the Process Under the Debugger":

    When starting the process under the debugger, the heap manager modifies all requests to create new heaps and change the heap creation flags to enable debug-friendly heaps (unless the _NO_DEBUG_HEAP environment variable is set to 1). In comparison, attaching to an already-running process, the heaps in the process have already been created using default heap creation flags and will not have the debug-friendly flags set (unless explicitly set by the application).

    (Also: a semi-related question, where I posted part of this answer before.)

提交回复
热议问题