Fixed VS memory tracking leaking into user code

parent 1f0bd128
#ifndef FLATBUFFERS_BASE_H_ #ifndef FLATBUFFERS_BASE_H_
#define FLATBUFFERS_BASE_H_ #define FLATBUFFERS_BASE_H_
#if defined(_MSC_VER) && defined(_DEBUG) #if defined(FLATBUFFERS_MEMORY_LEAK_TRACKING) && \
defined(_MSC_VER) && defined(_DEBUG)
#define _CRTDBG_MAP_ALLOC #define _CRTDBG_MAP_ALLOC
#endif #endif
...@@ -15,7 +16,8 @@ ...@@ -15,7 +16,8 @@
#include <cstdlib> #include <cstdlib>
#include <cstring> #include <cstring>
#if defined(_MSC_VER) && defined(_DEBUG) #if defined(FLATBUFFERS_MEMORY_LEAK_TRACKING) && \
defined(_MSC_VER) && defined(_DEBUG)
#include <crtdbg.h> #include <crtdbg.h>
#define DEBUG_NEW new(_NORMAL_BLOCK, __FILE__, __LINE__) #define DEBUG_NEW new(_NORMAL_BLOCK, __FILE__, __LINE__)
#define new DEBUG_NEW #define new DEBUG_NEW
......
...@@ -1749,7 +1749,8 @@ void TypeAliasesTest() ...@@ -1749,7 +1749,8 @@ void TypeAliasesTest()
} }
int main(int /*argc*/, const char * /*argv*/[]) { int main(int /*argc*/, const char * /*argv*/[]) {
#if defined(_MSC_VER) && defined(_DEBUG) #if defined(FLATBUFFERS_MEMORY_LEAK_TRACKING) && \
defined(_MSC_VER) && defined(_DEBUG)
_CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF _CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF
// For more thorough checking: // For more thorough checking:
//| _CRTDBG_CHECK_ALWAYS_DF | _CRTDBG_DELAY_FREE_MEM_DF //| _CRTDBG_CHECK_ALWAYS_DF | _CRTDBG_DELAY_FREE_MEM_DF
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment