tagging release
[dasher.git] / Src / DasherCore / MemoryLeak.cpp
blob6a2f3ef81f86a62911539672d9261a4eb763fdb5
2 #include "../Common/Common.h"
4 #ifdef _WIN32
6 #include "MemoryLeak.h"
8 void EnableLeakDetection( void )
10 #ifdef _DEBUG
11 _CrtSetDbgFlag( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF );
12 #endif
15 // Set the output to a file instead of the output window in Visual Studio
16 void SetOutputLeaksToFile()
18 #ifdef _DEBUG
19 HANDLE hLogFile;
21 #ifdef _UNICODE
22 hLogFile = CreateFile(L"memory_leak.log",
23 #else
24 hLogFile = CreateFile(TEXT("memory_leak.log"),
25 #endif
26 GENERIC_WRITE,
27 FILE_SHARE_WRITE,
28 NULL,
29 CREATE_ALWAYS,
30 FILE_ATTRIBUTE_NORMAL,
31 NULL);
33 _CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_FILE);
34 _CrtSetReportFile(_CRT_WARN, hLogFile);
35 _RPT0(_CRT_WARN,"file message\n");
37 #endif
40 #endif