hikyuu2/hikyuu_cpp/hikyuu/debug.h
2023-10-15 17:52:14 +08:00

32 lines
812 B
C++
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/*
* Copytright (C) hikyuu.org
*
* Created on: 2020-2-6
* Author: fasiondog
*
* 用途用于内存泄露检测cpp 文件包含此头文件以便内存泄露检测时可打印文件名等信息
*/
#pragma once
#if ENABLE_MSVC_LEAK_DETECT && defined(_MSC_VER) && (defined(_DEBUG) || defined(DEBUG))
#ifndef MSVC_LEAKER_DETECT
#define MSVC_LEAKER_DETECT
#endif
#endif
// clang-format off
// MSVC 内存泄露检测
#ifdef MSVC_LEAKER_DETECT
#define _CRTDBG_MAP_ALLOC
#include "crtdbg.h"
#ifndef DEBUG_CLIENTBLOCK
#define DEBUG_CLIENTBLOCK new (_CLIENT_BLOCK, __FILE__, __LINE__)
#define new DEBUG_CLIENTBLOCK
#endif /* #ifndef DEBUG_CLIENTBLOCK */
#else /* #if MSVC_LEAKER_DETECT */
#define DEBUG_CLIENTBLOCK
#endif /* #if MSVC_LEAKER_DETECT */
// clang-format on