diff --git a/include/Nazara/Audio/Debug.hpp b/include/Nazara/Audio/Debug.hpp index 926613875..dccffa01e 100644 --- a/include/Nazara/Audio/Debug.hpp +++ b/include/Nazara/Audio/Debug.hpp @@ -5,7 +5,4 @@ #include #if NAZARA_AUDIO_MEMORYLEAKTRACKER || defined(NAZARA_DEBUG) #include - - #define delete NzMemoryManager::NextFree(__FILE__, __LINE__), delete - #define new new(__FILE__, __LINE__) #endif diff --git a/include/Nazara/Core/Debug.hpp b/include/Nazara/Core/Debug.hpp index 99cc8ef1e..be5966cd2 100644 --- a/include/Nazara/Core/Debug.hpp +++ b/include/Nazara/Core/Debug.hpp @@ -5,7 +5,4 @@ #include #if NAZARA_CORE_MEMORYLEAKTRACKER || defined(NAZARA_DEBUG) #include - - #define delete NzMemoryManager::NextFree(__FILE__, __LINE__), delete - #define new new(__FILE__, __LINE__) #endif diff --git a/include/Nazara/Core/Debug/MemoryLeakTracker.hpp b/include/Nazara/Core/Debug/MemoryLeakTracker.hpp index 6f9ca5764..4db7fa3f2 100644 --- a/include/Nazara/Core/Debug/MemoryLeakTracker.hpp +++ b/include/Nazara/Core/Debug/MemoryLeakTracker.hpp @@ -14,14 +14,14 @@ class NAZARA_API NzMemoryManager { public: - NzMemoryManager(); - ~NzMemoryManager(); - static void* Allocate(std::size_t size, bool multi, const char* file = nullptr, unsigned int line = 0); static void Free(void* pointer, bool multi); static void NextFree(const char* file, unsigned int line); private: + NzMemoryManager(); + ~NzMemoryManager(); + static void Initialize(); static char* TimeInfo(); static void Uninitialize(); @@ -33,3 +33,8 @@ NAZARA_API void operator delete(void* ptr, const char* file, unsigned int line) NAZARA_API void operator delete[](void* ptr, const char* file, unsigned int line) throw(); #endif // NAZARA_DEBUG_MEMORYLEAKTRACKER_HPP + +#ifndef NAZARA_DEBUG_MEMORYLEAKTRACKER_DISABLE_REDEFINITION + #define delete NzMemoryManager::NextFree(__FILE__, __LINE__), delete + #define new new(__FILE__, __LINE__) +#endif diff --git a/include/Nazara/Debug.hpp b/include/Nazara/Debug.hpp index 0dc0cc6ec..432cd4266 100644 --- a/include/Nazara/Debug.hpp +++ b/include/Nazara/Debug.hpp @@ -2,7 +2,4 @@ // This file is part of the "Nazara Engine" // For conditions of distribution and use, see copyright notice in Config.hpp -#include - -#define delete NzMemoryManager::NextFree(__FILE__, __LINE__), delete -#define new new(__FILE__, __LINE__) +#include \ No newline at end of file diff --git a/include/Nazara/Graphics/Debug.hpp b/include/Nazara/Graphics/Debug.hpp index 9f5cb6a56..dcc23cc3b 100644 --- a/include/Nazara/Graphics/Debug.hpp +++ b/include/Nazara/Graphics/Debug.hpp @@ -5,7 +5,4 @@ #include #if NAZARA_GRAPHICS_MEMORYLEAKTRACKER || defined(NAZARA_DEBUG) #include - - #define delete NzMemoryManager::NextFree(__FILE__, __LINE__), delete - #define new new(__FILE__, __LINE__) #endif diff --git a/include/Nazara/Lua/Debug.hpp b/include/Nazara/Lua/Debug.hpp index cec39a67d..cedeceb4b 100644 --- a/include/Nazara/Lua/Debug.hpp +++ b/include/Nazara/Lua/Debug.hpp @@ -5,7 +5,4 @@ #include #if NAZARA_LUA_MEMORYLEAKTRACKER || defined(NAZARA_DEBUG) #include - - #define delete NzMemoryManager::NextFree(__FILE__, __LINE__), delete - #define new new(__FILE__, __LINE__) #endif diff --git a/include/Nazara/Noise/Debug.hpp b/include/Nazara/Noise/Debug.hpp index 7bdd4d0cc..2755e74a3 100644 --- a/include/Nazara/Noise/Debug.hpp +++ b/include/Nazara/Noise/Debug.hpp @@ -5,7 +5,4 @@ #include #if NAZARA_NOISE_MEMORYLEAKTRACKER || defined(NAZARA_DEBUG) #include - - #define delete NzMemoryManager::NextFree(__FILE__, __LINE__), delete - #define new new(__FILE__, __LINE__) #endif diff --git a/include/Nazara/Physics/Debug.hpp b/include/Nazara/Physics/Debug.hpp index ac9f89a58..ad3645499 100644 --- a/include/Nazara/Physics/Debug.hpp +++ b/include/Nazara/Physics/Debug.hpp @@ -5,7 +5,4 @@ #include #if NAZARA_PHYSICS_MEMORYLEAKTRACKER || defined(NAZARA_DEBUG) #include - - #define delete NzMemoryManager::NextFree(__FILE__, __LINE__), delete - #define new new(__FILE__, __LINE__) #endif diff --git a/include/Nazara/Renderer/Debug.hpp b/include/Nazara/Renderer/Debug.hpp index 2771e63ce..b610043ec 100644 --- a/include/Nazara/Renderer/Debug.hpp +++ b/include/Nazara/Renderer/Debug.hpp @@ -5,7 +5,4 @@ #include #if NAZARA_RENDERER_MEMORYLEAKTRACKER || defined(NAZARA_DEBUG) #include - - #define delete NzMemoryManager::NextFree(__FILE__, __LINE__), delete - #define new new(__FILE__, __LINE__) #endif diff --git a/include/Nazara/Utility/Debug.hpp b/include/Nazara/Utility/Debug.hpp index a563a7dcc..1670f1f30 100644 --- a/include/Nazara/Utility/Debug.hpp +++ b/include/Nazara/Utility/Debug.hpp @@ -5,7 +5,4 @@ #include #if NAZARA_UTILITY_MEMORYLEAKTRACKER || defined(NAZARA_DEBUG) #include - - #define delete NzMemoryManager::NextFree(__FILE__, __LINE__), delete - #define new new(__FILE__, __LINE__) #endif diff --git a/src/Nazara/Audio/Debug/Leaks.cpp b/src/Nazara/Audio/Debug/Leaks.cpp index 58fb5997e..e9fae0a5a 100644 --- a/src/Nazara/Audio/Debug/Leaks.cpp +++ b/src/Nazara/Audio/Debug/Leaks.cpp @@ -4,6 +4,9 @@ #include #if NAZARA_AUDIO_MEMORYLEAKTRACKER || defined(NAZARA_DEBUG) + +#define NAZARA_DEBUG_MEMORYLEAKTRACKER_DISABLE_REDEFINITION + #include #include @@ -26,4 +29,5 @@ void operator delete[](void* pointer) noexcept { NzMemoryManager::Free(pointer, true); } + #endif diff --git a/src/Nazara/Core/Debug/Leaks.cpp b/src/Nazara/Core/Debug/Leaks.cpp index f7b0e6838..470c86cb2 100644 --- a/src/Nazara/Core/Debug/Leaks.cpp +++ b/src/Nazara/Core/Debug/Leaks.cpp @@ -4,6 +4,9 @@ #include #if NAZARA_CORE_MEMORYLEAKTRACKER || defined(NAZARA_DEBUG) + +#define NAZARA_DEBUG_MEMORYLEAKTRACKER_DISABLE_REDEFINITION + #include #include diff --git a/src/Nazara/Core/ParameterList.cpp b/src/Nazara/Core/ParameterList.cpp index f934d0926..c341f98b2 100644 --- a/src/Nazara/Core/ParameterList.cpp +++ b/src/Nazara/Core/ParameterList.cpp @@ -2,6 +2,9 @@ // This file is part of the "Nazara Engine - Core module" // For conditions of distribution and use, see copyright notice in Config.hpp +// Notre utilisation du placement new n'est pas (encore ?) compatible avec les définitions du MLT +#define NAZARA_DEBUG_MEMORYLEAKTRACKER_DISABLE_REDEFINITION + #include #include #include diff --git a/src/Nazara/Graphics/Debug/Leaks.cpp b/src/Nazara/Graphics/Debug/Leaks.cpp index 4c7a2ffac..95eec00d1 100644 --- a/src/Nazara/Graphics/Debug/Leaks.cpp +++ b/src/Nazara/Graphics/Debug/Leaks.cpp @@ -4,6 +4,9 @@ #include #if NAZARA_GRAPHICS_MEMORYLEAKTRACKER || defined(NAZARA_DEBUG) + +#define NAZARA_DEBUG_MEMORYLEAKTRACKER_DISABLE_REDEFINITION + #include #include @@ -26,4 +29,5 @@ void operator delete[](void* pointer) noexcept { NzMemoryManager::Free(pointer, true); } + #endif diff --git a/src/Nazara/Lua/Debug/Leaks.cpp b/src/Nazara/Lua/Debug/Leaks.cpp index 07ebce8b7..319224a37 100644 --- a/src/Nazara/Lua/Debug/Leaks.cpp +++ b/src/Nazara/Lua/Debug/Leaks.cpp @@ -1,9 +1,12 @@ // Copyright (C) 2014 Jérôme Leclercq -// This file is part of the "Nazara Engine - Lua scripting module" +// This file is part of the "Nazara Engine - Lua module" // For conditions of distribution and use, see copyright notice in Config.hpp #include #if NAZARA_LUA_MEMORYLEAKTRACKER || defined(NAZARA_DEBUG) + +#define NAZARA_DEBUG_MEMORYLEAKTRACKER_DISABLE_REDEFINITION + #include #include @@ -26,4 +29,5 @@ void operator delete[](void* pointer) noexcept { NzMemoryManager::Free(pointer, true); } + #endif diff --git a/src/Nazara/Noise/Debug/Leaks.cpp b/src/Nazara/Noise/Debug/Leaks.cpp index ad87cac04..5b7c4aff7 100644 --- a/src/Nazara/Noise/Debug/Leaks.cpp +++ b/src/Nazara/Noise/Debug/Leaks.cpp @@ -1,9 +1,12 @@ -// Copyright (C) 2014 Rémi Bèges +// Copyright (C) 2014 Jérôme Leclercq // This file is part of the "Nazara Engine - Noise module" // For conditions of distribution and use, see copyright notice in Config.hpp #include #if NAZARA_NOISE_MEMORYLEAKTRACKER || defined(NAZARA_DEBUG) + +#define NAZARA_DEBUG_MEMORYLEAKTRACKER_DISABLE_REDEFINITION + #include #include diff --git a/src/Nazara/Physics/Debug/Leaks.cpp b/src/Nazara/Physics/Debug/Leaks.cpp index 619a421e1..34891a1f0 100644 --- a/src/Nazara/Physics/Debug/Leaks.cpp +++ b/src/Nazara/Physics/Debug/Leaks.cpp @@ -4,6 +4,9 @@ #include #if NAZARA_PHYSICS_MEMORYLEAKTRACKER || defined(NAZARA_DEBUG) + +#define NAZARA_DEBUG_MEMORYLEAKTRACKER_DISABLE_REDEFINITION + #include #include @@ -26,4 +29,5 @@ void operator delete[](void* pointer) noexcept { NzMemoryManager::Free(pointer, true); } + #endif diff --git a/src/Nazara/Renderer/Debug/Leaks.cpp b/src/Nazara/Renderer/Debug/Leaks.cpp index b7027a9a2..7762695e6 100644 --- a/src/Nazara/Renderer/Debug/Leaks.cpp +++ b/src/Nazara/Renderer/Debug/Leaks.cpp @@ -4,6 +4,9 @@ #include #if NAZARA_RENDERER_MEMORYLEAKTRACKER || defined(NAZARA_DEBUG) + +#define NAZARA_DEBUG_MEMORYLEAKTRACKER_DISABLE_REDEFINITION + #include #include @@ -26,4 +29,5 @@ void operator delete[](void* pointer) noexcept { NzMemoryManager::Free(pointer, true); } + #endif diff --git a/src/Nazara/Utility/Debug/Leaks.cpp b/src/Nazara/Utility/Debug/Leaks.cpp index 5affacea9..fde2100b5 100644 --- a/src/Nazara/Utility/Debug/Leaks.cpp +++ b/src/Nazara/Utility/Debug/Leaks.cpp @@ -4,6 +4,9 @@ #include #if NAZARA_UTILITY_MEMORYLEAKTRACKER || defined(NAZARA_DEBUG) + +#define NAZARA_DEBUG_MEMORYLEAKTRACKER_DISABLE_REDEFINITION + #include #include @@ -26,4 +29,5 @@ void operator delete[](void* pointer) noexcept { NzMemoryManager::Free(pointer, true); } + #endif