1 /*
2  *  Created by Martin on 12/07/2017.
3  *
4  *  Distributed under the Boost Software License, Version 1.0. (See accompanying
5  *  file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
6  */
7 
8  #include "catch_leak_detector.h"
9 
10 
11 #ifdef CATCH_CONFIG_WINDOWS_CRTDBG
12 #include <crtdbg.h>
13 
14 namespace Catch {
15 
LeakDetector()16 	LeakDetector::LeakDetector() {
17 		int flag = _CrtSetDbgFlag(_CRTDBG_REPORT_FLAG);
18 		flag |= _CRTDBG_LEAK_CHECK_DF;
19 		flag |= _CRTDBG_ALLOC_MEM_DF;
20 		_CrtSetDbgFlag(flag);
21 		_CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_FILE | _CRTDBG_MODE_DEBUG);
22 		_CrtSetReportFile(_CRT_WARN, _CRTDBG_FILE_STDERR);
23 		// Change this to leaking allocation's number to break there
24 		_CrtSetBreakAlloc(-1);
25 	}
26 }
27 
28 #else
29 
LeakDetector()30     Catch::LeakDetector::LeakDetector() {}
31 
32 #endif
33