Detecting memory leaks with crtdbg.h

Detecting memory leaks with crtdbg.h

_CrtSetBreakAlloc, _CrtDumpMemoryLeaks

See version :

Pas de dépendances

Download :

#include <crtdbg.h>
#include <stdlib.h>

int main()
{
    // BLOC 1
    int BreakAlloc=-1   ;
    _CrtSetBreakAlloc(BreakAlloc);
    // FIN BLOC 1

    {
        int* a = malloc(sizeof(int));
        //free(a);
    }

    // BLOC 2
    _CrtDumpMemoryLeaks();
    // FIN BLOC 2
    return 0;
}



Explanations

	No explanations yet.