// tbbmalloc_proxy: \r
// Replace the standard memory allocation routines in Microsoft* C/C++ RTL \r
// (malloc/free, global new/delete, etc.) with the TBB memory allocator. \r
-#include <tbb/tbbmalloc_proxy.h>\r
-\r
-#include "resource.h"\r
-\r
-#include "server.h"\r
\r
#ifdef _DEBUG\r
#define _CRTDBG_MAP_ALLOC\r
#include <stdlib.h>\r
#include <crtdbg.h>\r
+#else\r
+ #include <tbb/tbbmalloc_proxy.h>\r
#endif\r
\r
+#include "resource.h"\r
+\r
+#include "server.h"\r
+\r
#define NOMINMAX\r
#define WIN32_LEAN_AND_MEAN\r
\r
\r
// Set debug mode.\r
#ifdef _DEBUG\r
- _CrtSetDbgFlag ( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF | _CRTDBG_CHECK_ALWAYS_DF );\r
- _CrtSetReportMode( _CRT_ERROR, _CRTDBG_MODE_DEBUG );\r
- _CrtSetReportMode( _CRT_WARN, _CRTDBG_MODE_DEBUG );\r
- _CrtSetReportMode( _CRT_ASSERT, _CRTDBG_MODE_DEBUG );\r
+ HANDLE hLogFile;\r
+ hLogFile = CreateFile(L"crt_log.txt", GENERIC_WRITE, FILE_SHARE_WRITE, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);\r
+ std::shared_ptr<void> crt_log(nullptr, [](HANDLE h){::CloseHandle(h);});\r
+\r
+ _CrtSetDbgFlag (_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF);\r
+ _CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_FILE);\r
+ _CrtSetReportFile(_CRT_WARN, hLogFile);\r
+ _CrtSetReportMode(_CRT_ERROR, _CRTDBG_MODE_FILE);\r
+ _CrtSetReportFile(_CRT_ERROR, hLogFile);\r
+ _CrtSetReportMode(_CRT_ASSERT, _CRTDBG_MODE_FILE);\r
+ _CrtSetReportFile(_CRT_ASSERT, hLogFile);\r
#endif\r
\r
// Increase process priotity.\r