I am trying to use _crtBreakAlloc
in the Watch window as suggested in this link, but the value line says that 'identifier "_crtBreakAlloc" is unidentified' and it simply does not work.
What am I doing wrong? I'm using Visual Studio by the way.
An example of code:
#define _CRTDBG_MAP_ALLOC
#include <stdlib.h>
#include <crtdbg.h>
#include <malloc.h>
int main()
{
int *arr = (int*)malloc(10 * sizeof(int)); //breakpoint here
free(arr);
return 0;
}
I then write _crtBreakAlloc into the Name field of the Watch window and hit enter when encountering the breakpoint.
/MTd
or/MDd
). – PsychomancyDebug
and notRelease
configuration. Also make sure to do this:If you are using the multithreaded DLL version of the CRT library (the /MD option), include the context operator: {,,msvcr100d.dll}_crtBreakAlloc
(for VS2013 it'smsvcr120d
). – Psychomancy