sculpto
Main Page
Namespaces
Classes
Files
File List
File Members
utilities
macros
debug_memory_hook.h
Go to the documentation of this file.
1
/*!****************************************************************/
/*!*
2
* \file debug_memory_hook.h
3
* \brief Debug memory allocation controll hook definition module.
4
* Reports unfreed memory, if any.
5
*
6
* \author Sabitov Kirill
7
* \date 18 June 2022
8
*********************************************************************/
9
10
#pragma once
11
13
#include "
core/application/platform_detection.h
"
14
15
#if SCL_DEBUG_MEMORY_ENABLED && defined(SCL_PLATFORM_WINDOWS)
16
# ifndef NDEBUG
17
# define _CRTDBG_MAP_ALLOC
18
# include <crtdbg.h>
20
# define SclSetDbgMemHooks() _CrtSetDbgFlag( \
21
_CRTDBG_LEAK_CHECK_DF | _CRTDBG_CHECK_ALWAYS_DF | \
22
_CRTDBG_ALLOC_MEM_DF | _CrtSetDbgFlag(_CRTDBG_REPORT_FLAG) \
23
)
24
26
static
class
__Dummy
27
{
28
public
:
31
__Dummy() { SclSetDbgMemHooks(); }
32
} __ooppss;
33
# endif
34
# ifdef _DEBUG
35
# ifdef _CRTDBG_MAP_ALLOC
36
# define new new(_NORMAL_BLOCK, __FILE__, __LINE__)
37
# endif
38
# endif
39
#endif
platform_detection.h
Generated by
1.9.4