diff --git a/cli/main.cpp b/cli/main.cpp index 6333953cb..a203c9818 100644 --- a/cli/main.cpp +++ b/cli/main.cpp @@ -108,6 +108,11 @@ void CheckOther::checkZeroDivision() */ int main(int argc, char* argv[]) { + // MS Visual C++ memory leak debug tracing +#if defined(_MSC_VER) && defined(_DEBUG) + _CrtSetDbgFlag( _CrtSetDbgFlag( _CRTDBG_REPORT_FLAG ) | _CRTDBG_LEAK_CHECK_DF); +#endif + CppCheckExecutor exec; #ifdef _WIN32 char exename[1024] = {0}; diff --git a/lib/config.h b/lib/config.h index 130164d5e..b81b499c1 100644 --- a/lib/config.h +++ b/lib/config.h @@ -13,4 +13,10 @@ # define CPPCHECKLIB #endif +// MS Visual C++ memory leak debug tracing +#if defined(_MSC_VER) && defined(_DEBUG) +# define _CRTDBG_MAP_ALLOC +# include +#endif + #endif // configH