#define _CRTDBG_MAP_ALLOC #include <stdlib.h> #include <crtdbg.h> int _tmain(int argc, _TCHAR* argv[]) { _CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF); ... ... }