I've got the code below, which I think, based on Finding Memory Leaks Using the CRT Library, should print out the line number of a memory leak.
#include "stdafx.h"
#define _CRTDBG_MAP_ALLOC
#include <stdlib.h>
#include <crtdbg.h>
#include <iostream>
void derp()
{
int* q = new int;
}
int main()
{
_CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF);
derp();
return 0;
}
When I run it, I get the following:
Detected memory leaks!
Dumping objects ->
{75} normal block at 0x0067E930, 4 bytes long.
Data: < > CD CD CD CD
Object dump complete.
Based on Microsoft's documentation, I'd expect to see a print-out of the line where the leaky memory was allocated, but I don't.
What have I done wrong? I'm using VS2015.