From 9cd7976a91dd1b4b25f532a95d6b9194c19c6757 Mon Sep 17 00:00:00 2001 From: SirLynix Date: Sat, 24 Sep 2022 14:25:52 +0200 Subject: [PATCH] Remove "MemoryManager" and very old code --- include/Nazara/Audio/Config.hpp | 3 - include/Nazara/Audio/ConfigCheck.hpp | 6 +- include/Nazara/Audio/Debug.hpp | 5 - include/Nazara/Audio/DebugOff.hpp | 6 - include/Nazara/Core.hpp | 1 - include/Nazara/Core/Config.hpp | 12 - include/Nazara/Core/ConfigCheck.hpp | 7 - include/Nazara/Core/Debug.hpp | 5 - include/Nazara/Core/Debug/NewRedefinition.hpp | 29 -- include/Nazara/Core/DebugOff.hpp | 6 - include/Nazara/Core/MemoryManager.hpp | 45 -- include/Nazara/Graphics.hpp | 1 + include/Nazara/Graphics/Config.hpp | 3 - include/Nazara/Graphics/ConfigCheck.hpp | 6 - include/Nazara/Graphics/Debug.hpp | 5 - include/Nazara/Graphics/DebugOff.hpp | 6 - include/Nazara/Network/Config.hpp | 3 - include/Nazara/Network/ConfigCheck.hpp | 9 +- include/Nazara/Network/Debug.hpp | 5 - include/Nazara/Network/DebugOff.hpp | 6 - include/Nazara/OpenGLRenderer/Config.hpp | 3 - include/Nazara/OpenGLRenderer/ConfigCheck.hpp | 12 +- include/Nazara/OpenGLRenderer/Debug.hpp | 5 - include/Nazara/OpenGLRenderer/DebugOff.hpp | 6 - include/Nazara/Physics2D/Config.hpp | 3 - include/Nazara/Physics2D/ConfigCheck.hpp | 13 +- include/Nazara/Physics2D/Debug.hpp | 5 - include/Nazara/Physics2D/DebugOff.hpp | 6 - include/Nazara/Physics3D/Config.hpp | 3 - include/Nazara/Physics3D/ConfigCheck.hpp | 8 - include/Nazara/Physics3D/Debug.hpp | 5 - include/Nazara/Physics3D/DebugOff.hpp | 6 - include/Nazara/Platform/Config.hpp | 3 - include/Nazara/Platform/ConfigCheck.hpp | 6 - include/Nazara/Platform/Debug.hpp | 5 - include/Nazara/Platform/DebugOff.hpp | 6 - include/Nazara/Renderer/Config.hpp | 3 - include/Nazara/Renderer/ConfigCheck.hpp | 8 +- include/Nazara/Renderer/Debug.hpp | 5 - include/Nazara/Renderer/DebugOff.hpp | 6 - include/Nazara/Utility/Config.hpp | 3 - include/Nazara/Utility/ConfigCheck.hpp | 6 - include/Nazara/Utility/Debug.hpp | 5 - include/Nazara/Utility/DebugOff.hpp | 6 - include/Nazara/VulkanRenderer/Config.hpp | 3 - include/Nazara/VulkanRenderer/ConfigCheck.hpp | 9 +- include/Nazara/VulkanRenderer/Debug.hpp | 5 - include/Nazara/VulkanRenderer/DebugOff.hpp | 6 - include/Nazara/Widgets/Config.hpp | 3 - include/Nazara/Widgets/ConfigCheck.hpp | 6 - include/Nazara/Widgets/Debug.hpp | 5 - include/Nazara/Widgets/DebugOff.hpp | 6 - src/Nazara/Audio/Debug/NewOverload.cpp | 31 -- src/Nazara/Audio/Sound.cpp | 8 +- src/Nazara/Audio/SoundBuffer.cpp | 3 - src/Nazara/Core/Debug/NewOverload.cpp | 31 -- src/Nazara/Core/Debug/NewRedefinition.cpp | 38 -- src/Nazara/Core/DynLib.cpp | 10 +- src/Nazara/Core/File.cpp | 2 - src/Nazara/Core/MemoryManager.cpp | 460 ------------------ src/Nazara/Graphics/Debug/NewOverload.cpp | 31 -- src/Nazara/Network/Debug/NewOverload.cpp | 31 -- .../OpenGLRenderer/Debug/NewOverload.cpp | 31 -- src/Nazara/Physics2D/Debug/NewOverload.cpp | 31 -- src/Nazara/Physics3D/Debug/NewOverload.cpp | 31 -- src/Nazara/Platform/Debug/NewOverload.cpp | 31 -- src/Nazara/Renderer/Debug/NewOverload.cpp | 31 -- src/Nazara/Utility/Debug/NewOverload.cpp | 31 -- .../VulkanRenderer/Debug/NewOverload.cpp | 31 -- src/Nazara/Widgets/Debug/NewOverload.cpp | 31 -- 70 files changed, 21 insertions(+), 1221 deletions(-) delete mode 100644 include/Nazara/Core/Debug/NewRedefinition.hpp delete mode 100644 include/Nazara/Core/MemoryManager.hpp delete mode 100644 src/Nazara/Audio/Debug/NewOverload.cpp delete mode 100644 src/Nazara/Core/Debug/NewOverload.cpp delete mode 100644 src/Nazara/Core/Debug/NewRedefinition.cpp delete mode 100644 src/Nazara/Core/MemoryManager.cpp delete mode 100644 src/Nazara/Graphics/Debug/NewOverload.cpp delete mode 100644 src/Nazara/Network/Debug/NewOverload.cpp delete mode 100644 src/Nazara/OpenGLRenderer/Debug/NewOverload.cpp delete mode 100644 src/Nazara/Physics2D/Debug/NewOverload.cpp delete mode 100644 src/Nazara/Physics3D/Debug/NewOverload.cpp delete mode 100644 src/Nazara/Platform/Debug/NewOverload.cpp delete mode 100644 src/Nazara/Renderer/Debug/NewOverload.cpp delete mode 100644 src/Nazara/Utility/Debug/NewOverload.cpp delete mode 100644 src/Nazara/VulkanRenderer/Debug/NewOverload.cpp delete mode 100644 src/Nazara/Widgets/Debug/NewOverload.cpp diff --git a/include/Nazara/Audio/Config.hpp b/include/Nazara/Audio/Config.hpp index 1927c6ba3..2558d6fe7 100644 --- a/include/Nazara/Audio/Config.hpp +++ b/include/Nazara/Audio/Config.hpp @@ -34,9 +34,6 @@ /// Each modification of a parameter needs a recompilation of the module -// Use the MemoryManager to manage dynamic allocations (can detect memory leak but allocations/frees are slower) -#define NAZARA_AUDIO_MANAGE_MEMORY 0 - // Activate the security tests based on the code (Advised for development) #define NAZARA_AUDIO_SAFE 1 diff --git a/include/Nazara/Audio/ConfigCheck.hpp b/include/Nazara/Audio/ConfigCheck.hpp index 2539622ad..007844197 100644 --- a/include/Nazara/Audio/ConfigCheck.hpp +++ b/include/Nazara/Audio/ConfigCheck.hpp @@ -12,11 +12,7 @@ #include #define NazaraCheckTypeAndVal(name, type, op, val, err) static_assert(std::is_ ##type ::value && name op val, #type err) -// We force the value of MANAGE_MEMORY in debug -#if defined(NAZARA_DEBUG) && !NAZARA_AUDIO_MANAGE_MEMORY - #undef NAZARA_AUDIO_MANAGE_MEMORY - #define NAZARA_AUDIO_MANAGE_MEMORY 0 -#endif +// config checks #undef NazaraCheckTypeAndVal diff --git a/include/Nazara/Audio/Debug.hpp b/include/Nazara/Audio/Debug.hpp index 44e26503f..9679faacb 100644 --- a/include/Nazara/Audio/Debug.hpp +++ b/include/Nazara/Audio/Debug.hpp @@ -3,8 +3,3 @@ // For conditions of distribution and use, see copyright notice in Config.hpp // no header guards - -#include -#if NAZARA_AUDIO_MANAGE_MEMORY - #include -#endif diff --git a/include/Nazara/Audio/DebugOff.hpp b/include/Nazara/Audio/DebugOff.hpp index bc96f355e..9679faacb 100644 --- a/include/Nazara/Audio/DebugOff.hpp +++ b/include/Nazara/Audio/DebugOff.hpp @@ -3,9 +3,3 @@ // For conditions of distribution and use, see copyright notice in Config.hpp // no header guards - -// We assume that Debug.hpp has already been included, same thing for Config.hpp -#if NAZARA_AUDIO_MANAGE_MEMORY - #undef delete - #undef new -#endif diff --git a/include/Nazara/Core.hpp b/include/Nazara/Core.hpp index 68cc69662..a17ca0220 100644 --- a/include/Nazara/Core.hpp +++ b/include/Nazara/Core.hpp @@ -52,7 +52,6 @@ #include #include #include -#include #include #include #include diff --git a/include/Nazara/Core/Config.hpp b/include/Nazara/Core/Config.hpp index c2809bc9a..af8b71a3e 100644 --- a/include/Nazara/Core/Config.hpp +++ b/include/Nazara/Core/Config.hpp @@ -52,21 +52,9 @@ // Incorporate the Unicode Character Data table (Necessary to make it work with the flag String::HandleUTF8) #define NAZARA_CORE_INCLUDE_UNICODEDATA 1 -// Use the MemoryManager to manage dynamic allocations (can detect memory leak but allocations/frees are slower) -#define NAZARA_CORE_MANAGE_MEMORY 0 - // Activate the security tests based on the code (Advised for development) #define NAZARA_CORE_SAFE 1 -// Number of spinlocks to use with the Windows critical sections (0 to disable) -#define NAZARA_CORE_WINDOWS_CS_SPINLOCKS 4096 - - -/* -// Sets the time between waking thread timers and activating a timer (in milliseconds) -#define NAZARA_CORE_TIMER_WAKEUPTIME 10 -*/ - /// Checking the values and types of certain constants #include diff --git a/include/Nazara/Core/ConfigCheck.hpp b/include/Nazara/Core/ConfigCheck.hpp index 6377de805..ae3e54ebc 100644 --- a/include/Nazara/Core/ConfigCheck.hpp +++ b/include/Nazara/Core/ConfigCheck.hpp @@ -12,15 +12,8 @@ #include #define NazaraCheckTypeAndVal(name, type, op, val, err) static_assert(std::is_ ##type ::value && name op val, #type err) -// We force the value of MANAGE_MEMORY in debug -#if defined(NAZARA_DEBUG) && !NAZARA_CORE_MANAGE_MEMORY - #undef NAZARA_CORE_MANAGE_MEMORY - #define NAZARA_CORE_MANAGE_MEMORY 0 -#endif - NazaraCheckTypeAndVal(NAZARA_CORE_DECIMAL_DIGITS, integral, >, 0, " shall be a strictly positive integer"); NazaraCheckTypeAndVal(NAZARA_CORE_FILE_BUFFERSIZE, integral, >, 0, " shall be a strictly positive integer"); -NazaraCheckTypeAndVal(NAZARA_CORE_WINDOWS_CS_SPINLOCKS, integral, >=, 0, " shall be a positive integer"); #undef NazaraCheckTypeAndVal diff --git a/include/Nazara/Core/Debug.hpp b/include/Nazara/Core/Debug.hpp index aa7a30a00..829571a4a 100644 --- a/include/Nazara/Core/Debug.hpp +++ b/include/Nazara/Core/Debug.hpp @@ -3,8 +3,3 @@ // For conditions of distribution and use, see copyright notice in Config.hpp // no header guards - -#include -#if NAZARA_CORE_MANAGE_MEMORY - #include -#endif diff --git a/include/Nazara/Core/Debug/NewRedefinition.hpp b/include/Nazara/Core/Debug/NewRedefinition.hpp deleted file mode 100644 index 882a1ac1b..000000000 --- a/include/Nazara/Core/Debug/NewRedefinition.hpp +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright (C) 2022 Jérôme "Lynix" Leclercq (lynix680@gmail.com) -// This file is part of the "Nazara Engine - Core module" -// For conditions of distribution and use, see copyright notice in Config.hpp - -// no header guards - -#include - -#if NAZARA_CORE_MANAGE_MEMORY - -#ifndef NAZARA_CORE_DEBUG_NEWREDEFINITION_HPP -#define NAZARA_CORE_DEBUG_NEWREDEFINITION_HPP - -#include -#include - -NAZARA_CORE_API void* operator new(std::size_t size, const char* file, unsigned int line); -NAZARA_CORE_API void* operator new[](std::size_t size, const char* file, unsigned int line); -NAZARA_CORE_API void operator delete(void* ptr, const char* file, unsigned int line) noexcept; -NAZARA_CORE_API void operator delete[](void* ptr, const char* file, unsigned int line) noexcept; - -#endif // NAZARA_DEBUG_NEWREDEFINITION_HPP - -#ifndef NAZARA_DEBUG_NEWREDEFINITION_DISABLE_REDEFINITION - #define delete MemoryManager::NextFree(__FILE__, __LINE__), delete - #define new new(__FILE__, __LINE__) -#endif - -#endif // NAZARA_CORE_DEBUG_NEWREDEFINITION_HPP diff --git a/include/Nazara/Core/DebugOff.hpp b/include/Nazara/Core/DebugOff.hpp index 1d3b00332..829571a4a 100644 --- a/include/Nazara/Core/DebugOff.hpp +++ b/include/Nazara/Core/DebugOff.hpp @@ -3,9 +3,3 @@ // For conditions of distribution and use, see copyright notice in Config.hpp // no header guards - -// We assume that Debug.hpp has already been included, same thing for Config.hpp -#if NAZARA_CORE_MANAGE_MEMORY - #undef delete - #undef new -#endif diff --git a/include/Nazara/Core/MemoryManager.hpp b/include/Nazara/Core/MemoryManager.hpp deleted file mode 100644 index 7833e6e25..000000000 --- a/include/Nazara/Core/MemoryManager.hpp +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright (C) 2022 Jérôme "Lynix" Leclercq (lynix680@gmail.com) -// This file is part of the "Nazara Engine - Core module" -// For conditions of distribution and use, see copyright notice in Config.hpp - -#pragma once - -#ifndef NAZARA_CORE_MEMORYMANAGER_HPP -#define NAZARA_CORE_MEMORYMANAGER_HPP - -#include -#include -#include - -namespace Nz -{ - class NAZARA_CORE_API MemoryManager - { - public: - static void* Allocate(std::size_t size, bool multi = false, const char* file = nullptr, unsigned int line = 0); - - static void EnableAllocationFilling(bool allocationFilling); - static void EnableAllocationLogging(bool logAllocations); - - static void Free(void* pointer, bool multi = false); - - static unsigned int GetAllocatedBlockCount(); - static std::size_t GetAllocatedSize(); - static unsigned int GetAllocationCount(); - - static bool IsAllocationFillingEnabled(); - static bool IsAllocationLoggingEnabled(); - - static void NextFree(const char* file, unsigned int line); - - private: - MemoryManager(); - ~MemoryManager(); - - static void Initialize(); - static void TimeInfo(char buffer[23]); - static void Uninitialize(); - }; -} - -#endif // NAZARA_CORE_MEMORYMANAGER_HPP diff --git a/include/Nazara/Graphics.hpp b/include/Nazara/Graphics.hpp index c235a51ae..5f6def45b 100644 --- a/include/Nazara/Graphics.hpp +++ b/include/Nazara/Graphics.hpp @@ -49,6 +49,7 @@ #include #include #include +#include #include #include #include diff --git a/include/Nazara/Graphics/Config.hpp b/include/Nazara/Graphics/Config.hpp index da0f10ee4..a8ce03dc1 100644 --- a/include/Nazara/Graphics/Config.hpp +++ b/include/Nazara/Graphics/Config.hpp @@ -34,9 +34,6 @@ /// Each modification of a parameter needs a recompilation of the module -// Use the MemoryManager to manage dynamic allocations (can detect memory leak but allocations/frees are slower) -#define NAZARA_GRAPHICS_MANAGE_MEMORY 0 - // Activate the security tests based on the code (Advised for development) #define NAZARA_GRAPHICS_SAFE 1 diff --git a/include/Nazara/Graphics/ConfigCheck.hpp b/include/Nazara/Graphics/ConfigCheck.hpp index 11cb1297c..f89c3eeb4 100644 --- a/include/Nazara/Graphics/ConfigCheck.hpp +++ b/include/Nazara/Graphics/ConfigCheck.hpp @@ -12,12 +12,6 @@ #include #define NazaraCheckTypeAndVal(name, type, op, val, err) static_assert(std::is_ ##type ::value && name op val, #type err) -// We force the value of MANAGE_MEMORY in debug -#if defined(NAZARA_DEBUG) && !NAZARA_GRAPHICS_MANAGE_MEMORY - #undef NAZARA_GRAPHICS_MANAGE_MEMORY - #define NAZARA_GRAPHICS_MANAGE_MEMORY 0 -#endif - #undef NazaraCheckTypeAndVal #endif // NAZARA_GRAPHICS_CONFIGCHECK_HPP diff --git a/include/Nazara/Graphics/Debug.hpp b/include/Nazara/Graphics/Debug.hpp index 52b054ed5..2923b2668 100644 --- a/include/Nazara/Graphics/Debug.hpp +++ b/include/Nazara/Graphics/Debug.hpp @@ -3,8 +3,3 @@ // For conditions of distribution and use, see copyright notice in Config.hpp // no header guards - -#include -#if NAZARA_GRAPHICS_MANAGE_MEMORY - #include -#endif diff --git a/include/Nazara/Graphics/DebugOff.hpp b/include/Nazara/Graphics/DebugOff.hpp index 14815d6d9..2923b2668 100644 --- a/include/Nazara/Graphics/DebugOff.hpp +++ b/include/Nazara/Graphics/DebugOff.hpp @@ -3,9 +3,3 @@ // For conditions of distribution and use, see copyright notice in Config.hpp // no header guards - -// We assume that Debug.hpp has already been included, same thing for Config.hpp -#if NAZARA_GRAPHICS_MANAGE_MEMORY - #undef delete - #undef new -#endif diff --git a/include/Nazara/Network/Config.hpp b/include/Nazara/Network/Config.hpp index bad003dca..5a174dd1e 100644 --- a/include/Nazara/Network/Config.hpp +++ b/include/Nazara/Network/Config.hpp @@ -34,9 +34,6 @@ /// Each modification of a paramater of the module needs a recompilation of the unit -// Use the MemoryManager to manage dynamic allocations (can detect memory leak but allocations/frees are slower) -#define NAZARA_NETWORK_MANAGE_MEMORY 0 - // Activate the security tests based on the code (Advised for development) #define NAZARA_NETWORK_SAFE 1 diff --git a/include/Nazara/Network/ConfigCheck.hpp b/include/Nazara/Network/ConfigCheck.hpp index e3a5faa4d..ecaab1558 100644 --- a/include/Nazara/Network/ConfigCheck.hpp +++ b/include/Nazara/Network/ConfigCheck.hpp @@ -10,11 +10,10 @@ /// This file is used to check the constant values defined in Config.hpp #include +#define NazaraCheckTypeAndVal(name, type, op, val, err) static_assert(std::is_ ##type ::value && name op val, #type err) -// We fore the value of MANAGE_MEMORY in debug -#if defined(NAZARA_DEBUG) && !NAZARA_NETWORK_MANAGE_MEMORY - #undef NAZARA_NETWORK_MANAGE_MEMORY - #define NAZARA_NETWORK_MANAGE_MEMORY 0 -#endif +// config checks + +#undef NazaraCheckTypeAndVal #endif // NAZARA_NETWORK_CONFIGCHECK_HPP diff --git a/include/Nazara/Network/Debug.hpp b/include/Nazara/Network/Debug.hpp index ae9260751..a2cd10a8e 100644 --- a/include/Nazara/Network/Debug.hpp +++ b/include/Nazara/Network/Debug.hpp @@ -3,8 +3,3 @@ // For conditions of distribution and use, see copyright notice in Config.hpp // no header guards - -#include -#if NAZARA_NETWORK_MANAGE_MEMORY - #include -#endif diff --git a/include/Nazara/Network/DebugOff.hpp b/include/Nazara/Network/DebugOff.hpp index 99490e438..a2cd10a8e 100644 --- a/include/Nazara/Network/DebugOff.hpp +++ b/include/Nazara/Network/DebugOff.hpp @@ -3,9 +3,3 @@ // For conditions of distribution and use, see copyright notice in Config.hpp // no header guards - -// We suppose that Debug.hpp is already included, same goes for Config.hpp -#if NAZARA_NETWORK_MANAGE_MEMORY - #undef delete - #undef new -#endif diff --git a/include/Nazara/OpenGLRenderer/Config.hpp b/include/Nazara/OpenGLRenderer/Config.hpp index 2f667e5f6..8b6f7947f 100644 --- a/include/Nazara/OpenGLRenderer/Config.hpp +++ b/include/Nazara/OpenGLRenderer/Config.hpp @@ -29,9 +29,6 @@ /// Chaque modification d'un paramètre du module nécessite une recompilation de celui-ci -// Utilise le MemoryManager pour gérer les allocations dynamiques (détecte les leaks au prix d'allocations/libérations dynamiques plus lentes) -#define NAZARA_OPENGLRENDERER_MANAGE_MEMORY 0 - // Active les tests de sécurité basés sur le code (Conseillé pour le développement) #define NAZARA_OPENGLRENDERER_SAFE 1 diff --git a/include/Nazara/OpenGLRenderer/ConfigCheck.hpp b/include/Nazara/OpenGLRenderer/ConfigCheck.hpp index f1cac4c5e..898fc9f95 100644 --- a/include/Nazara/OpenGLRenderer/ConfigCheck.hpp +++ b/include/Nazara/OpenGLRenderer/ConfigCheck.hpp @@ -7,16 +7,6 @@ #ifndef NAZARA_OPENGLRENDERER_CONFIGCHECK_HPP #define NAZARA_OPENGLRENDERER_CONFIGCHECK_HPP -/// Ce fichier sert à vérifier la valeur des constantes du fichier Config.hpp - -#include -#define CheckType(name, type, err) static_assert(std::is_ ##type ::value, #type err) -#define CheckTypeAndVal(name, type, op, val, err) static_assert(std::is_ ##type ::value && name op val, #type err) - -// On force la valeur de MANAGE_MEMORY en mode debug -#if defined(NAZARA_DEBUG) && !NAZARA_OPENGLRENDERER_MANAGE_MEMORY - #undef NAZARA_OPENGLRENDERER_MANAGE_MEMORY - #define NAZARA_OPENGLRENDERER_MANAGE_MEMORY 0 -#endif +/// This file is used to check the constant values defined in Config.hpp #endif // NAZARA_OPENGLRENDERER_CONFIGCHECK_HPP diff --git a/include/Nazara/OpenGLRenderer/Debug.hpp b/include/Nazara/OpenGLRenderer/Debug.hpp index 5a4b2a239..788b475c0 100644 --- a/include/Nazara/OpenGLRenderer/Debug.hpp +++ b/include/Nazara/OpenGLRenderer/Debug.hpp @@ -3,8 +3,3 @@ // For conditions of distribution and use, see copyright notice in Config.hpp // no header guards - -#include -#if NAZARA_OPENGLRENDERER_MANAGE_MEMORY - #include -#endif diff --git a/include/Nazara/OpenGLRenderer/DebugOff.hpp b/include/Nazara/OpenGLRenderer/DebugOff.hpp index 2e0177093..788b475c0 100644 --- a/include/Nazara/OpenGLRenderer/DebugOff.hpp +++ b/include/Nazara/OpenGLRenderer/DebugOff.hpp @@ -3,9 +3,3 @@ // For conditions of distribution and use, see copyright notice in Config.hpp // no header guards - -// On suppose que Debug.hpp a déjà été inclus, tout comme Config.hpp -#if NAZARA_OPENGLRENDERER_MANAGE_MEMORY - #undef delete - #undef new -#endif diff --git a/include/Nazara/Physics2D/Config.hpp b/include/Nazara/Physics2D/Config.hpp index 9313f5d8f..79de9115a 100644 --- a/include/Nazara/Physics2D/Config.hpp +++ b/include/Nazara/Physics2D/Config.hpp @@ -29,9 +29,6 @@ /// Chaque modification d'un paramètre du module nécessite une recompilation de celui-ci -// Utilise un manager de mémoire pour gérer les allocations dynamiques (détecte les leaks au prix d'allocations/libérations dynamiques plus lentes) -#define NAZARA_PHYSICS2D_MANAGE_MEMORY 0 - // Active les tests de sécurité basés sur le code (Conseillé pour le développement) #define NAZARA_PHYSICS2D_SAFE 1 diff --git a/include/Nazara/Physics2D/ConfigCheck.hpp b/include/Nazara/Physics2D/ConfigCheck.hpp index f4e947a1b..561ea6c5c 100644 --- a/include/Nazara/Physics2D/ConfigCheck.hpp +++ b/include/Nazara/Physics2D/ConfigCheck.hpp @@ -7,12 +7,13 @@ #ifndef NAZARA_PHYSICS2D_CONFIGCHECK_HPP #define NAZARA_PHYSICS2D_CONFIGCHECK_HPP -/// Ce fichier sert à vérifier la valeur des constantes du fichier Config.hpp +/// This file is used to check the constant values defined in Config.hpp -// On force la valeur de MANAGE_MEMORY en mode debug -#if defined(NAZARA_DEBUG) && !NAZARA_PHYSICS2D_MANAGE_MEMORY - #undef NAZARA_PHYSICS2D_MANAGE_MEMORY - #define NAZARA_PHYSICS2D_MANAGE_MEMORY 0 -#endif +#include +#define NazaraCheckTypeAndVal(name, type, op, val, err) static_assert(std::is_ ##type ::value && name op val, #type err) + +// config checks + +#undef NazaraCheckTypeAndVal #endif // NAZARA_PHYSICS2D_CONFIGCHECK_HPP diff --git a/include/Nazara/Physics2D/Debug.hpp b/include/Nazara/Physics2D/Debug.hpp index 34942954e..5508ff899 100644 --- a/include/Nazara/Physics2D/Debug.hpp +++ b/include/Nazara/Physics2D/Debug.hpp @@ -3,8 +3,3 @@ // For conditions of distribution and use, see copyright notice in Config.hpp // no header guards - -#include -#if NAZARA_PHYSICS2D_MANAGE_MEMORY - #include -#endif diff --git a/include/Nazara/Physics2D/DebugOff.hpp b/include/Nazara/Physics2D/DebugOff.hpp index bbad8c40d..5508ff899 100644 --- a/include/Nazara/Physics2D/DebugOff.hpp +++ b/include/Nazara/Physics2D/DebugOff.hpp @@ -3,9 +3,3 @@ // For conditions of distribution and use, see copyright notice in Config.hpp // no header guards - -// On suppose que Debug.hpp a déjà été inclus, tout comme Config.hpp -#if NAZARA_PHYSICS2D_MANAGE_MEMORY - #undef delete - #undef new -#endif diff --git a/include/Nazara/Physics3D/Config.hpp b/include/Nazara/Physics3D/Config.hpp index 591dfe3f3..b65a83b6e 100644 --- a/include/Nazara/Physics3D/Config.hpp +++ b/include/Nazara/Physics3D/Config.hpp @@ -29,9 +29,6 @@ /// Chaque modification d'un paramètre du module nécessite une recompilation de celui-ci -// Utilise un manager de mémoire pour gérer les allocations dynamiques (détecte les leaks au prix d'allocations/libérations dynamiques plus lentes) -#define NAZARA_PHYSICS3D_MANAGE_MEMORY 0 - // Active les tests de sécurité basés sur le code (Conseillé pour le développement) #define NAZARA_PHYSICS3D_SAFE 1 diff --git a/include/Nazara/Physics3D/ConfigCheck.hpp b/include/Nazara/Physics3D/ConfigCheck.hpp index 001d3f00f..72e3e89b8 100644 --- a/include/Nazara/Physics3D/ConfigCheck.hpp +++ b/include/Nazara/Physics3D/ConfigCheck.hpp @@ -7,12 +7,4 @@ #ifndef NAZARA_PHYSICS3D_CONFIGCHECK_HPP #define NAZARA_PHYSICS3D_CONFIGCHECK_HPP -/// Ce fichier sert à vérifier la valeur des constantes du fichier Config.hpp - -// On force la valeur de MANAGE_MEMORY en mode debug -#if defined(NAZARA_DEBUG) && !NAZARA_PHYSICS3D_MANAGE_MEMORY - #undef NAZARA_PHYSICS3D_MANAGE_MEMORY - #define NAZARA_PHYSICS3D_MANAGE_MEMORY 0 -#endif - #endif // NAZARA_PHYSICS3D_CONFIGCHECK_HPP diff --git a/include/Nazara/Physics3D/Debug.hpp b/include/Nazara/Physics3D/Debug.hpp index 779a5bfc6..9314ac601 100644 --- a/include/Nazara/Physics3D/Debug.hpp +++ b/include/Nazara/Physics3D/Debug.hpp @@ -3,8 +3,3 @@ // For conditions of distribution and use, see copyright notice in Config.hpp // no header guards - -#include -#if NAZARA_PHYSICS3D_MANAGE_MEMORY - #include -#endif diff --git a/include/Nazara/Physics3D/DebugOff.hpp b/include/Nazara/Physics3D/DebugOff.hpp index 88fb45ed0..9314ac601 100644 --- a/include/Nazara/Physics3D/DebugOff.hpp +++ b/include/Nazara/Physics3D/DebugOff.hpp @@ -3,9 +3,3 @@ // For conditions of distribution and use, see copyright notice in Config.hpp // no header guards - -// On suppose que Debug.hpp a déjà été inclus, tout comme Config.hpp -#if NAZARA_PHYSICS3D_MANAGE_MEMORY - #undef delete - #undef new -#endif diff --git a/include/Nazara/Platform/Config.hpp b/include/Nazara/Platform/Config.hpp index 16bcc2a31..f61bb2d2e 100644 --- a/include/Nazara/Platform/Config.hpp +++ b/include/Nazara/Platform/Config.hpp @@ -29,9 +29,6 @@ /// Each modification of a parameter needs a recompilation of the module -// Use the MemoryManager to manage dynamic allocations (can detect memory leak but allocations/frees are slower) -#define NAZARA_PLATFORM_MANAGE_MEMORY 0 - // Activate the security tests based on the code (Advised for development) #define NAZARA_PLATFORM_SAFE 1 diff --git a/include/Nazara/Platform/ConfigCheck.hpp b/include/Nazara/Platform/ConfigCheck.hpp index d32f17f7f..854a2480b 100644 --- a/include/Nazara/Platform/ConfigCheck.hpp +++ b/include/Nazara/Platform/ConfigCheck.hpp @@ -12,12 +12,6 @@ #include #define NazaraCheckTypeAndVal(name, type, op, val, err) static_assert(std::is_ ##type ::value && name op val, #type err) -// We force the value of MANAGE_MEMORY in debug -#if defined(NAZARA_DEBUG) && !NAZARA_PLATFORM_MANAGE_MEMORY - #undef NAZARA_PLATFORM_MANAGE_MEMORY - #define NAZARA_PLATFORM_MANAGE_MEMORY 0 -#endif - #undef NazaraCheckTypeAndVal #endif // NAZARA_PLATFORM_CONFIGCHECK_HPP diff --git a/include/Nazara/Platform/Debug.hpp b/include/Nazara/Platform/Debug.hpp index 6b2eef368..0aae05c63 100644 --- a/include/Nazara/Platform/Debug.hpp +++ b/include/Nazara/Platform/Debug.hpp @@ -3,8 +3,3 @@ // For conditions of distribution and use, see copyright notice in Config.hpp // no header guards - -#include -#if NAZARA_PLATFORM_MANAGE_MEMORY - #include -#endif diff --git a/include/Nazara/Platform/DebugOff.hpp b/include/Nazara/Platform/DebugOff.hpp index 45e968a80..0aae05c63 100644 --- a/include/Nazara/Platform/DebugOff.hpp +++ b/include/Nazara/Platform/DebugOff.hpp @@ -3,9 +3,3 @@ // For conditions of distribution and use, see copyright notice in Config.hpp // no header guards - -// We suppose that Debug.hpp is already included, same goes for Config.hpp -#if NAZARA_PLATFORM_MANAGE_MEMORY - #undef delete - #undef new -#endif diff --git a/include/Nazara/Renderer/Config.hpp b/include/Nazara/Renderer/Config.hpp index 569fcb540..d731adb02 100644 --- a/include/Nazara/Renderer/Config.hpp +++ b/include/Nazara/Renderer/Config.hpp @@ -32,9 +32,6 @@ // La taille du buffer d'Instancing (définit le nombre maximum d'instances en un rendu) #define NAZARA_RENDERER_INSTANCE_BUFFER_SIZE 1 * 1024 * 1024 -// Utilise un manager de mémoire pour gérer les allocations dynamiques (détecte les leaks au prix d'allocations/libérations dynamiques plus lentes) -#define NAZARA_RENDERER_MANAGE_MEMORY 0 - // Active le paramère debug des paramètres des contextes par défaut (Perte de performances mais capable de recevoir des messages d'OpenGL) #define NAZARA_RENDERER_OPENGL_DEBUG 0 diff --git a/include/Nazara/Renderer/ConfigCheck.hpp b/include/Nazara/Renderer/ConfigCheck.hpp index 9458cf9ea..dc46fbb2b 100644 --- a/include/Nazara/Renderer/ConfigCheck.hpp +++ b/include/Nazara/Renderer/ConfigCheck.hpp @@ -7,17 +7,11 @@ #ifndef NAZARA_RENDERER_CONFIGCHECK_HPP #define NAZARA_RENDERER_CONFIGCHECK_HPP -/// Ce fichier sert à vérifier la valeur des constantes du fichier Config.hpp +/// This file is used to check the constant values defined in Config.hpp #include #define NazaraCheckTypeAndVal(name, type, op, val, err) static_assert(std::is_ ##type ::value && name op val, #type err) -// On force la valeur de MANAGE_MEMORY en mode debug -#if defined(NAZARA_DEBUG) && !NAZARA_RENDERER_MANAGE_MEMORY - #undef NAZARA_RENDERER_MANAGE_MEMORY - #define NAZARA_RENDERER_MANAGE_MEMORY 0 -#endif - NazaraCheckTypeAndVal(NAZARA_RENDERER_INSTANCE_BUFFER_SIZE, integral, >, 0, " shall be a strictly positive integer"); #undef NazaraCheckTypeAndVal diff --git a/include/Nazara/Renderer/Debug.hpp b/include/Nazara/Renderer/Debug.hpp index 2d2193535..ed9332274 100644 --- a/include/Nazara/Renderer/Debug.hpp +++ b/include/Nazara/Renderer/Debug.hpp @@ -3,8 +3,3 @@ // For conditions of distribution and use, see copyright notice in Config.hpp // no header guards - -#include -#if NAZARA_RENDERER_MANAGE_MEMORY - #include -#endif diff --git a/include/Nazara/Renderer/DebugOff.hpp b/include/Nazara/Renderer/DebugOff.hpp index d7633534b..ed9332274 100644 --- a/include/Nazara/Renderer/DebugOff.hpp +++ b/include/Nazara/Renderer/DebugOff.hpp @@ -3,9 +3,3 @@ // For conditions of distribution and use, see copyright notice in Config.hpp // no header guards - -// On suppose que Debug.hpp a déjà été inclus, tout comme Config.hpp -#if NAZARA_RENDERER_MANAGE_MEMORY - #undef delete - #undef new -#endif diff --git a/include/Nazara/Utility/Config.hpp b/include/Nazara/Utility/Config.hpp index 7a8856f26..2096219ef 100644 --- a/include/Nazara/Utility/Config.hpp +++ b/include/Nazara/Utility/Config.hpp @@ -29,9 +29,6 @@ /// Each modification of a parameter needs a recompilation of the module -// Use the MemoryManager to manage dynamic allocations (can detect memory leak but allocations/frees are slower) -#define NAZARA_UTILITY_MANAGE_MEMORY 0 - // Activate the security tests based on the code (Advised for development) #define NAZARA_UTILITY_SAFE 1 diff --git a/include/Nazara/Utility/ConfigCheck.hpp b/include/Nazara/Utility/ConfigCheck.hpp index 71d45d1ce..cc03277c0 100644 --- a/include/Nazara/Utility/ConfigCheck.hpp +++ b/include/Nazara/Utility/ConfigCheck.hpp @@ -12,12 +12,6 @@ #include #define NazaraCheckTypeAndVal(name, type, op, val, err) static_assert(std::is_ ##type ::value && name op val, #type err) -// We force the value of MANAGE_MEMORY in debug -#if defined(NAZARA_DEBUG) && !NAZARA_UTILITY_MANAGE_MEMORY - #undef NAZARA_UTILITY_MANAGE_MEMORY - #define NAZARA_UTILITY_MANAGE_MEMORY 0 -#endif - NazaraCheckTypeAndVal(NAZARA_UTILITY_SKINNING_MAX_WEIGHTS, integral, >, 0, " shall be a strictly positive integer"); #undef NazaraCheckTypeAndVal diff --git a/include/Nazara/Utility/Debug.hpp b/include/Nazara/Utility/Debug.hpp index 044e9737b..e9b90cf59 100644 --- a/include/Nazara/Utility/Debug.hpp +++ b/include/Nazara/Utility/Debug.hpp @@ -3,8 +3,3 @@ // For conditions of distribution and use, see copyright notice in Config.hpp // no header guards - -#include -#if NAZARA_UTILITY_MANAGE_MEMORY - #include -#endif diff --git a/include/Nazara/Utility/DebugOff.hpp b/include/Nazara/Utility/DebugOff.hpp index b48404c41..e9b90cf59 100644 --- a/include/Nazara/Utility/DebugOff.hpp +++ b/include/Nazara/Utility/DebugOff.hpp @@ -3,9 +3,3 @@ // For conditions of distribution and use, see copyright notice in Config.hpp // no header guards - -// On suppose que Debug.hpp a déjà été inclus, tout comme Config.hpp -#if NAZARA_UTILITY_MANAGE_MEMORY - #undef delete - #undef new -#endif diff --git a/include/Nazara/VulkanRenderer/Config.hpp b/include/Nazara/VulkanRenderer/Config.hpp index 911f327b0..669192095 100644 --- a/include/Nazara/VulkanRenderer/Config.hpp +++ b/include/Nazara/VulkanRenderer/Config.hpp @@ -29,9 +29,6 @@ /// Chaque modification d'un paramètre du module nécessite une recompilation de celui-ci -// Utilise le MemoryManager pour gérer les allocations dynamiques (détecte les leaks au prix d'allocations/libérations dynamiques plus lentes) -#define NAZARA_VULKANRENDERER_MANAGE_MEMORY 0 - // Active les tests de sécurité basés sur le code (Conseillé pour le développement) #define NAZARA_VULKANRENDERER_SAFE 1 diff --git a/include/Nazara/VulkanRenderer/ConfigCheck.hpp b/include/Nazara/VulkanRenderer/ConfigCheck.hpp index 049904eab..8f259d7f2 100644 --- a/include/Nazara/VulkanRenderer/ConfigCheck.hpp +++ b/include/Nazara/VulkanRenderer/ConfigCheck.hpp @@ -7,16 +7,13 @@ #ifndef NAZARA_VULKANRENDERER_CONFIGCHECK_HPP #define NAZARA_VULKANRENDERER_CONFIGCHECK_HPP -/// Ce fichier sert à vérifier la valeur des constantes du fichier Config.hpp +/// This file is used to check the constant values defined in Config.hpp #include #define CheckType(name, type, err) static_assert(std::is_ ##type ::value, #type err) #define CheckTypeAndVal(name, type, op, val, err) static_assert(std::is_ ##type ::value && name op val, #type err) -// On force la valeur de MANAGE_MEMORY en mode debug -#if defined(NAZARA_DEBUG) && !NAZARA_VULKANRENDERER_MANAGE_MEMORY - #undef NAZARA_VULKANRENDERER_MANAGE_MEMORY - #define NAZARA_VULKANRENDERER_MANAGE_MEMORY 0 -#endif +#undef CheckType +#undef CheckTypeAndVal #endif // NAZARA_VULKANRENDERER_CONFIGCHECK_HPP diff --git a/include/Nazara/VulkanRenderer/Debug.hpp b/include/Nazara/VulkanRenderer/Debug.hpp index c014480ba..523947372 100644 --- a/include/Nazara/VulkanRenderer/Debug.hpp +++ b/include/Nazara/VulkanRenderer/Debug.hpp @@ -3,8 +3,3 @@ // For conditions of distribution and use, see copyright notice in Config.hpp // no header guards - -#include -#if NAZARA_VULKANRENDERER_MANAGE_MEMORY - #include -#endif diff --git a/include/Nazara/VulkanRenderer/DebugOff.hpp b/include/Nazara/VulkanRenderer/DebugOff.hpp index c9a4179d4..523947372 100644 --- a/include/Nazara/VulkanRenderer/DebugOff.hpp +++ b/include/Nazara/VulkanRenderer/DebugOff.hpp @@ -3,9 +3,3 @@ // For conditions of distribution and use, see copyright notice in Config.hpp // no header guards - -// On suppose que Debug.hpp a déjà été inclus, tout comme Config.hpp -#if NAZARA_VULKANRENDERER_MANAGE_MEMORY - #undef delete - #undef new -#endif diff --git a/include/Nazara/Widgets/Config.hpp b/include/Nazara/Widgets/Config.hpp index aede44b5e..838174bcc 100644 --- a/include/Nazara/Widgets/Config.hpp +++ b/include/Nazara/Widgets/Config.hpp @@ -34,9 +34,6 @@ /// Each modification of a parameter needs a recompilation of the module -// Use the MemoryManager to manage dynamic allocations (can detect memory leak but allocations/frees are slower) -#define NAZARA_WIDGETS_MANAGE_MEMORY 0 - /// Checking the values and types of certain constants #include diff --git a/include/Nazara/Widgets/ConfigCheck.hpp b/include/Nazara/Widgets/ConfigCheck.hpp index e8a71548d..9d7e808cf 100644 --- a/include/Nazara/Widgets/ConfigCheck.hpp +++ b/include/Nazara/Widgets/ConfigCheck.hpp @@ -12,12 +12,6 @@ #include #define NazaraCheckTypeAndVal(name, type, op, val, err) static_assert(std::is_ ##type ::value && name op val, #type err) -// We force the value of MANAGE_MEMORY in debug -#if defined(NAZARA_DEBUG) && !NAZARA_WIDGETS_MANAGE_MEMORY - #undef NAZARA_WIDGETS_MANAGE_MEMORY - #define NAZARA_WIDGETS_MANAGE_MEMORY 0 -#endif - #undef NazaraCheckTypeAndVal #endif // NAZARA_WIDGETS_CONFIGCHECK_HPP diff --git a/include/Nazara/Widgets/Debug.hpp b/include/Nazara/Widgets/Debug.hpp index 761272d0e..6d2d92a5d 100644 --- a/include/Nazara/Widgets/Debug.hpp +++ b/include/Nazara/Widgets/Debug.hpp @@ -3,8 +3,3 @@ // For conditions of distribution and use, see copyright notice in Config.hpp // no header guards - -#include -#if NAZARA_WIDGETS_MANAGE_MEMORY - #include -#endif diff --git a/include/Nazara/Widgets/DebugOff.hpp b/include/Nazara/Widgets/DebugOff.hpp index 55d1c9e2a..6d2d92a5d 100644 --- a/include/Nazara/Widgets/DebugOff.hpp +++ b/include/Nazara/Widgets/DebugOff.hpp @@ -3,9 +3,3 @@ // For conditions of distribution and use, see copyright notice in Config.hpp // no header guards - -// We assume that Debug.hpp has already been included, same thing for Config.hpp -#if NAZARA_WIDGETS_MANAGE_MEMORY - #undef delete - #undef new -#endif diff --git a/src/Nazara/Audio/Debug/NewOverload.cpp b/src/Nazara/Audio/Debug/NewOverload.cpp deleted file mode 100644 index 050374283..000000000 --- a/src/Nazara/Audio/Debug/NewOverload.cpp +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright (C) 2022 Jérôme "Lynix" Leclercq (lynix680@gmail.com) -// This file is part of the "Nazara Engine - Audio module" -// For conditions of distribution and use, see copyright notice in Config.hpp - -#include -#if NAZARA_AUDIO_MANAGE_MEMORY - -#include -#include // Nécessaire ? - -void* operator new(std::size_t size) -{ - return Nz::MemoryManager::Allocate(size, false); -} - -void* operator new[](std::size_t size) -{ - return Nz::MemoryManager::Allocate(size, true); -} - -void operator delete(void* pointer) noexcept -{ - Nz::MemoryManager::Free(pointer, false); -} - -void operator delete[](void* pointer) noexcept -{ - Nz::MemoryManager::Free(pointer, true); -} - -#endif // NAZARA_AUDIO_MANAGE_MEMORY diff --git a/src/Nazara/Audio/Sound.cpp b/src/Nazara/Audio/Sound.cpp index b67eb854f..36fcdc824 100644 --- a/src/Nazara/Audio/Sound.cpp +++ b/src/Nazara/Audio/Sound.cpp @@ -192,8 +192,6 @@ namespace Nz /*! * \brief Plays the music - * - * \remark Produces a NazaraError if the sound is not playable with NAZARA_AUDIO_SAFE defined */ void Sound::Play() { @@ -203,11 +201,9 @@ namespace Nz } /*! - * \brief Sets the internal buffer + * \brief Sets the audio buffer * - * \param buffer Internal buffer - * - * \remark Produces a NazaraError if buffer is invalid with NAZARA_AUDIO_SAFE defined + * \param buffer Audio buffer */ void Sound::SetBuffer(std::shared_ptr buffer) { diff --git a/src/Nazara/Audio/SoundBuffer.cpp b/src/Nazara/Audio/SoundBuffer.cpp index f214351c6..e60df0fe7 100644 --- a/src/Nazara/Audio/SoundBuffer.cpp +++ b/src/Nazara/Audio/SoundBuffer.cpp @@ -40,9 +40,6 @@ namespace Nz * \param sampleCount Number of samples * \param sampleRate Rate of samples * \param samples Samples raw data - * - * \remark Produces a NazaraError if creation went wrong with NAZARA_AUDIO_SAFE defined - * \remark Produces a std::runtime_error if creation went wrong with NAZARA_AUDIO_SAFE defined */ SoundBuffer::SoundBuffer(AudioFormat format, UInt64 sampleCount, UInt32 sampleRate, const Int16* samples) { diff --git a/src/Nazara/Core/Debug/NewOverload.cpp b/src/Nazara/Core/Debug/NewOverload.cpp deleted file mode 100644 index 21b869520..000000000 --- a/src/Nazara/Core/Debug/NewOverload.cpp +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright (C) 2022 Jérôme "Lynix" Leclercq (lynix680@gmail.com) -// This file is part of the "Nazara Engine - Core module" -// For conditions of distribution and use, see copyright notice in Config.hpp - -#include -#if NAZARA_CORE_MANAGE_MEMORY - -#include -#include // Nécessaire ? - -void* operator new(std::size_t size) -{ - return Nz::MemoryManager::Allocate(size, false); -} - -void* operator new[](std::size_t size) -{ - return Nz::MemoryManager::Allocate(size, true); -} - -void operator delete(void* pointer) noexcept -{ - Nz::MemoryManager::Free(pointer, false); -} - -void operator delete[](void* pointer) noexcept -{ - Nz::MemoryManager::Free(pointer, true); -} - -#endif // NAZARA_CORE_MANAGE_MEMORY diff --git a/src/Nazara/Core/Debug/NewRedefinition.cpp b/src/Nazara/Core/Debug/NewRedefinition.cpp deleted file mode 100644 index 88cb4ee6b..000000000 --- a/src/Nazara/Core/Debug/NewRedefinition.cpp +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright (C) 2022 Jérôme "Lynix" Leclercq (lynix680@gmail.com) -// This file is part of the "Nazara Engine - Core module" -// For conditions of distribution and use, see copyright notice in Config.hpp - -// no include fix - -#include -#if NAZARA_CORE_MANAGE_MEMORY - -#include -#include // Nécessaire ? - -#define NAZARA_DEBUG_NEWREDEFINITION_DISABLE_REDEFINITION -#include - -void* operator new(std::size_t size, const char* file, unsigned int line) -{ - return Nz::MemoryManager::Allocate(size, false, file, line); -} - -void* operator new[](std::size_t size, const char* file, unsigned int line) -{ - return Nz::MemoryManager::Allocate(size, true, file, line); -} - -void operator delete(void* ptr, const char* file, unsigned int line) noexcept -{ - Nz::MemoryManager::NextFree(file, line); - Nz::MemoryManager::Free(ptr, false); -} - -void operator delete[](void* ptr, const char* file, unsigned int line) noexcept -{ - Nz::MemoryManager::NextFree(file, line); - Nz::MemoryManager::Free(ptr, true); -} - -#endif // NAZARA_CORE_MANAGE_MEMORY diff --git a/src/Nazara/Core/DynLib.cpp b/src/Nazara/Core/DynLib.cpp index e7658b314..01a7426f0 100644 --- a/src/Nazara/Core/DynLib.cpp +++ b/src/Nazara/Core/DynLib.cpp @@ -41,18 +41,10 @@ namespace Nz /*! * \brief Gets the symbol for the name * \return Function which is the symbol of the function name - * - * \remark Produces a NazaraError if library is not loaded with NAZARA_CORE_SAFE defined */ DynLibFunc DynLib::GetSymbol(const char* symbol) const { - #if NAZARA_CORE_SAFE - if (!IsLoaded()) - { - NazaraError("Library not opened"); - return nullptr; - } - #endif + NazaraAssert(IsLoaded(), "library was not opened"); return m_impl->GetSymbol(symbol, &m_lastError); } diff --git a/src/Nazara/Core/File.cpp b/src/Nazara/Core/File.cpp index 196c6ec4b..c9edf49b8 100644 --- a/src/Nazara/Core/File.cpp +++ b/src/Nazara/Core/File.cpp @@ -381,8 +381,6 @@ namespace Nz * \brief Checks whether the file has reached the end of the stream * \return true if cursor is at the end of the file * - * \remark Produces a NazaraError if file is not open with NAZARA_CORE_SAFE defined - * * \see EndOfFile */ bool File::TestStreamEnd() const diff --git a/src/Nazara/Core/MemoryManager.cpp b/src/Nazara/Core/MemoryManager.cpp deleted file mode 100644 index 41330e304..000000000 --- a/src/Nazara/Core/MemoryManager.cpp +++ /dev/null @@ -1,460 +0,0 @@ -// Copyright (C) 2022 Jérôme "Lynix" Leclercq (lynix680@gmail.com) -// This file is part of the "Nazara Engine - Core module" -// For conditions of distribution and use, see copyright notice in Config.hpp - -#include -#include -#include -#include -#include -#include - -#if defined(NAZARA_PLATFORM_WINDOWS) - #include -#elif defined(NAZARA_PLATFORM_POSIX) - #include -#endif - -// no include fix -// The only file that does not need to include Debug.hpp - -namespace Nz -{ - namespace NAZARA_ANONYMOUS_NAMESPACE - { - constexpr unsigned int s_allocatedId = 0xDEADB33FUL; - constexpr unsigned int s_freedId = 0x4B1DUL; - - struct Block - { - std::size_t size; - const char* file; - Block* prev; - Block* next; - bool array; - unsigned int line; - unsigned int magic; - }; - - bool s_allocationFilling = true; - bool s_allocationLogging = false; - bool s_initialized = false; - const char* s_logFileName = "NazaraMemory.log"; - thread_local const char* s_nextFreeFile = "(Internal error)"; - thread_local unsigned int s_nextFreeLine = 0; - - Block s_list = - { - 0, - nullptr, - &s_list, - &s_list, - false, - 0, - 0 - }; - - unsigned int s_allocationCount = 0; - unsigned int s_allocatedBlock = 0; - std::size_t s_allocatedSize = 0; - - #if defined(NAZARA_PLATFORM_WINDOWS) - CRITICAL_SECTION s_mutex; - #elif defined(NAZARA_PLATFORM_POSIX) - pthread_mutex_t s_mutex = PTHREAD_MUTEX_INITIALIZER; - #else - #error Lack of implementation: Mutex - #endif - } - - /*! - * \ingroup core - * \class Nz::MemoryManager - * \brief Core class that represents a manager for the memory - */ - - /*! - * \brief Constructs a MemoryManager object by default - */ - - MemoryManager::MemoryManager() - { - } - - /*! - * \brief Destructs a MemoryManager object and calls Unitialize - */ - - MemoryManager::~MemoryManager() - { - Uninitialize(); - } - - /*! - * \brief Allocates memory - * \return Raw memory allocated - * - * \param size Size to allocate - * \param multi Array or not - * \param file File of the allocation - * \param line Line of the allocation in the file - */ - - void* MemoryManager::Allocate(std::size_t size, bool multi, const char* file, unsigned int line) - { - NAZARA_USE_ANONYMOUS_NAMESPACE - - if (!s_initialized) - Initialize(); - - #if defined(NAZARA_PLATFORM_WINDOWS) - EnterCriticalSection(&s_mutex); - #elif defined(NAZARA_PLATFORM_POSIX) - pthread_mutex_lock(&s_mutex); - #endif - - Block* ptr = static_cast(std::malloc(size+sizeof(Block))); - if (!ptr) - { - char timeStr[23]; - TimeInfo(timeStr); - - FILE* log = std::fopen(s_logFileName, "a"); - - if (file) - std::fprintf(log, "%s Failed to allocate %zu bytes at %s:%u\n", timeStr, size, file, line); - else - std::fprintf(log, "%s Failed to allocate %zu bytes at unknown position\n", timeStr, size); - - std::fclose(log); - - throw std::bad_alloc(); - } - - ptr->array = multi; - ptr->file = file; - ptr->line = line; - ptr->size = size; - ptr->magic = s_allocatedId; - - ptr->prev = s_list.prev; - ptr->next = &s_list; - s_list.prev->next = ptr; - s_list.prev = ptr; - - s_allocatedBlock++; - s_allocatedSize += size; - s_allocationCount++; - - if (s_allocationFilling) - { - UInt8* data = reinterpret_cast(ptr) + sizeof(Block); - std::memset(data, 0xFF, size); - } - - if (s_allocationLogging) - { - char timeStr[23]; - TimeInfo(timeStr); - - FILE* log = std::fopen(s_logFileName, "a"); - - if (file) - std::fprintf(log, "%s Allocated %zu bytes at %s:%u\n", timeStr, size, file, line); - else - std::fprintf(log, "%s Allocated %zu bytes at unknown position\n", timeStr, size); - - std::fclose(log); - } - - #if defined(NAZARA_PLATFORM_WINDOWS) - LeaveCriticalSection(&s_mutex); - #elif defined(NAZARA_PLATFORM_POSIX) - pthread_mutex_unlock(&s_mutex); - #endif - - return reinterpret_cast(ptr) + sizeof(Block); - } - - /*! - * \brief Enables the filling of the allocation - * - * \param allocationFilling If true, sets the rest of the allocation block to '0xFF' - */ - - void MemoryManager::EnableAllocationFilling(bool allocationFilling) - { - NAZARA_USE_ANONYMOUS_NAMESPACE - - s_allocationFilling = allocationFilling; - } - - /*! - * \brief Enables the logging of the allocation - * - * \param logAllocations If true, registers every allocation - */ - - void MemoryManager::EnableAllocationLogging(bool logAllocations) - { - NAZARA_USE_ANONYMOUS_NAMESPACE - - s_allocationLogging = logAllocations; - } - - /*! - * \brief Frees the pointer - * - * \param pointer Pointer to free - * \param multi Array or not - * - * \remark If pointer is nullptr, nothing is done - */ - - void MemoryManager::Free(void* pointer, bool multi) - { - NAZARA_USE_ANONYMOUS_NAMESPACE - - if (!pointer) - return; - - Block* ptr = reinterpret_cast(static_cast(pointer) - sizeof(Block)); - if (ptr->magic != s_allocatedId) - { - char timeStr[23]; - TimeInfo(timeStr); - - FILE* log = std::fopen(s_logFileName, "a"); - - const char* error = (ptr->magic == s_freedId) ? "double-delete" : "possible delete of dangling pointer"; - if (s_nextFreeFile) - std::fprintf(log, "%s Warning: %s at %s:%u\n", timeStr, error, s_nextFreeFile, s_nextFreeLine); - else - std::fprintf(log, "%s Warning: %s at unknown position\n", timeStr, error); - - std::fclose(log); - return; - } - - #if defined(NAZARA_PLATFORM_WINDOWS) - EnterCriticalSection(&s_mutex); - #elif defined(NAZARA_PLATFORM_POSIX) - pthread_mutex_lock(&s_mutex); - #endif - - if (ptr->array != multi) - { - char timeStr[23]; - TimeInfo(timeStr); - - FILE* log = std::fopen(s_logFileName, "a"); - - const char* error = (multi) ? "delete[] after new" : "delete after new[]"; - if (s_nextFreeFile) - std::fprintf(log, "%s Warning: %s at %s:%u\n", timeStr, error, s_nextFreeFile, s_nextFreeLine); - else - std::fprintf(log, "%s Warning: %s at unknown position\n", timeStr, error); - - std::fclose(log); - } - - ptr->magic = s_freedId; - ptr->prev->next = ptr->next; - ptr->next->prev = ptr->prev; - - s_allocatedBlock--; - s_allocatedSize -= ptr->size; - - if (s_allocationFilling) - { - UInt8* data = reinterpret_cast(ptr) + sizeof(Block); - std::memset(data, 0xFF, ptr->size); - } - - std::free(ptr); - - s_nextFreeFile = nullptr; - s_nextFreeLine = 0; - - #if defined(NAZARA_PLATFORM_WINDOWS) - LeaveCriticalSection(&s_mutex); - #elif defined(NAZARA_PLATFORM_POSIX) - pthread_mutex_unlock(&s_mutex); - #endif - } - - /*! - * \brief Gets the number of allocated blocks - * \return Number of allocated blocks - */ - - unsigned int MemoryManager::GetAllocatedBlockCount() - { - NAZARA_USE_ANONYMOUS_NAMESPACE - - return s_allocatedBlock; - } - - /*! - * \brief Gets the allocated size - * \return Size of total allocation - */ - - std::size_t MemoryManager::GetAllocatedSize() - { - NAZARA_USE_ANONYMOUS_NAMESPACE - - return s_allocatedSize; - } - - /*! - * \brief Gets the number of allocations - * \return Number of allocations - */ - - unsigned int MemoryManager::GetAllocationCount() - { - NAZARA_USE_ANONYMOUS_NAMESPACE - - return s_allocationCount; - } - - /*! - * \brief Checks whether the filling of allocation is enabled - * \return true if it is filling - */ - - bool MemoryManager::IsAllocationFillingEnabled() - { - NAZARA_USE_ANONYMOUS_NAMESPACE - - return s_allocationFilling; - } - - /*! - * \brief Checks whether the logging of allocation is enabled - * \return true if it is logging - */ - - bool MemoryManager::IsAllocationLoggingEnabled() - { - NAZARA_USE_ANONYMOUS_NAMESPACE - - return s_allocationLogging; - } - - /*! - * \brief Sets the next free - * - * \param file Name of the file - * \param line Line in the file - */ - - void MemoryManager::NextFree(const char* file, unsigned int line) - { - NAZARA_USE_ANONYMOUS_NAMESPACE - - s_nextFreeFile = file; - s_nextFreeLine = line; - } - - /*! - * \brief Initializes the MemoryManager - */ - - void MemoryManager::Initialize() - { - NAZARA_USE_ANONYMOUS_NAMESPACE - - char timeStr[23]; - TimeInfo(timeStr); - - FILE* file = std::fopen(s_logFileName, "w"); - std::fprintf(file, "%s ==============================\n", timeStr); - std::fprintf(file, "%s Nazara Memory Leak Tracker \n", timeStr); - std::fprintf(file, "%s ==============================\n", timeStr); - std::fclose(file); - - if (std::atexit(Uninitialize) != 0) - { - static MemoryManager manager; - } - - #ifdef NAZARA_PLATFORM_WINDOWS - InitializeCriticalSection(&s_mutex); - //#elif defined(NAZARA_PLATFORM_POSIX) is already done in the namespace - #endif - - s_initialized = true; - } - - /*! - * \brief Gets the time - * - * \param buffer Buffer to set the time in - */ - - void MemoryManager::TimeInfo(char buffer[23]) - { - time_t currentTime = std::time(nullptr); - std::strftime(buffer, 23, "%d/%m/%Y - %H:%M:%S:", std::localtime(¤tTime)); - } - - /*! - * \brief Uninitializes the MemoryManager - */ - - void MemoryManager::Uninitialize() - { - NAZARA_USE_ANONYMOUS_NAMESPACE - - #ifdef NAZARA_PLATFORM_WINDOWS - DeleteCriticalSection(&s_mutex); - #elif defined(NAZARA_PLATFORM_POSIX) - pthread_mutex_destroy(&s_mutex); - #endif - - FILE* log = std::fopen(s_logFileName, "a"); - - char timeStr[23]; - TimeInfo(timeStr); - - std::fprintf(log, "%s Application finished, checking leaks...\n", timeStr); - - if (s_allocatedBlock == 0) - { - std::fprintf(log, "%s ==============================\n", timeStr); - std::fprintf(log, "%s No leak detected \n", timeStr); - std::fprintf(log, "%s ==============================", timeStr); - } - else - { - std::fprintf(log, "%s ==============================\n", timeStr); - std::fprintf(log, "%s Leaks have been detected \n", timeStr); - std::fprintf(log, "%s ==============================\n\n", timeStr); - std::fputs("Leak list:\n", log); - - Block* ptr = s_list.next; - while (ptr != &s_list) - { - if (ptr->file) - std::fprintf(log, "-0x%s -> %zu bytes allocated at %s:%u\n", reinterpret_cast(ptr) + sizeof(Block), ptr->size, ptr->file, ptr->line); - else - std::fprintf(log, "-0x%s -> %zu bytes allocated at unknown position\n", reinterpret_cast(ptr) + sizeof(Block), ptr->size); - - void* pointer = ptr; - ptr = ptr->next; - - std::free(pointer); - } - - std::fprintf(log, "\n%u blocks leaked (%zu bytes)", s_allocatedBlock, s_allocatedSize); - } - - std::fclose(log); - } -} - -#if defined(NAZARA_PLATFORM_WINDOWS) -#include -#endif diff --git a/src/Nazara/Graphics/Debug/NewOverload.cpp b/src/Nazara/Graphics/Debug/NewOverload.cpp deleted file mode 100644 index 062d17013..000000000 --- a/src/Nazara/Graphics/Debug/NewOverload.cpp +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright (C) 2022 Jérôme "Lynix" Leclercq (lynix680@gmail.com) -// This file is part of the "Nazara Engine - Graphics module" -// For conditions of distribution and use, see copyright notice in Config.hpp - -#include -#if NAZARA_GRAPHICS_MANAGE_MEMORY - -#include -#include // Nécessaire ? - -void* operator new(std::size_t size) -{ - return Nz::MemoryManager::Allocate(size, false); -} - -void* operator new[](std::size_t size) -{ - return Nz::MemoryManager::Allocate(size, true); -} - -void operator delete(void* pointer) noexcept -{ - Nz::MemoryManager::Free(pointer, false); -} - -void operator delete[](void* pointer) noexcept -{ - Nz::MemoryManager::Free(pointer, true); -} - -#endif diff --git a/src/Nazara/Network/Debug/NewOverload.cpp b/src/Nazara/Network/Debug/NewOverload.cpp deleted file mode 100644 index 9e7dcc5fb..000000000 --- a/src/Nazara/Network/Debug/NewOverload.cpp +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright (C) 2022 Jérôme "Lynix" Leclercq (lynix680@gmail.com) -// This file is part of the "Nazara Engine - Network module" -// For conditions of distribution and use, see copyright notice in Config.hpp - -#include -#if NAZARA_NETWORK_MANAGE_MEMORY - -#include -#include // Is this necessary ? - -void* operator new(std::size_t size) -{ - return Nz::MemoryManager::Allocate(size, false); -} - -void* operator new[](std::size_t size) -{ - return Nz::MemoryManager::Allocate(size, true); -} - -void operator delete(void* pointer) noexcept -{ - Nz::MemoryManager::Free(pointer, false); -} - -void operator delete[](void* pointer) noexcept -{ - Nz::MemoryManager::Free(pointer, true); -} - -#endif // NAZARA_NETWORK_MANAGE_MEMORY diff --git a/src/Nazara/OpenGLRenderer/Debug/NewOverload.cpp b/src/Nazara/OpenGLRenderer/Debug/NewOverload.cpp deleted file mode 100644 index e561ae96c..000000000 --- a/src/Nazara/OpenGLRenderer/Debug/NewOverload.cpp +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright (C) 2022 Jérôme "Lynix" Leclercq (lynix680@gmail.com) -// This file is part of the "Nazara Engine - OpenGL renderer" -// For conditions of distribution and use, see copyright notice in Config.hpp - -#include -#if NAZARA_OPENGLRENDERER_MANAGE_MEMORY - -#include -#include // Nécessaire ? - -void* operator new(std::size_t size) -{ - return Nz::MemoryManager::Allocate(size, false); -} - -void* operator new[](std::size_t size) -{ - return Nz::MemoryManager::Allocate(size, true); -} - -void operator delete(void* pointer) noexcept -{ - Nz::MemoryManager::Free(pointer, false); -} - -void operator delete[](void* pointer) noexcept -{ - Nz::MemoryManager::Free(pointer, true); -} - -#endif // NAZARA_OPENGLRENDERER_MANAGE_MEMORY diff --git a/src/Nazara/Physics2D/Debug/NewOverload.cpp b/src/Nazara/Physics2D/Debug/NewOverload.cpp deleted file mode 100644 index 0460aa1f5..000000000 --- a/src/Nazara/Physics2D/Debug/NewOverload.cpp +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright (C) 2022 Jérôme "Lynix" Leclercq (lynix680@gmail.com) -// This file is part of the "Nazara Engine - Physics2D module" -// For conditions of distribution and use, see copyright notice in Config.hpp - -#include -#if NAZARA_PHYSICS2D_MANAGE_MEMORY - -#include -#include // Nécessaire ? - -void* operator new(std::size_t size) -{ - return Nz::MemoryManager::Allocate(size, false); -} - -void* operator new[](std::size_t size) -{ - return Nz::MemoryManager::Allocate(size, true); -} - -void operator delete(void* pointer) noexcept -{ - Nz::MemoryManager::Free(pointer, false); -} - -void operator delete[](void* pointer) noexcept -{ - Nz::MemoryManager::Free(pointer, true); -} - -#endif // NAZARA_PHYSICS_MANAGE_MEMORY diff --git a/src/Nazara/Physics3D/Debug/NewOverload.cpp b/src/Nazara/Physics3D/Debug/NewOverload.cpp deleted file mode 100644 index 499b5fab9..000000000 --- a/src/Nazara/Physics3D/Debug/NewOverload.cpp +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright (C) 2022 Jérôme "Lynix" Leclercq (lynix680@gmail.com) -// This file is part of the "Nazara Engine - Physics3D module" -// For conditions of distribution and use, see copyright notice in Config.hpp - -#include -#if NAZARA_PHYSICS3D_MANAGE_MEMORY - -#include -#include // Nécessaire ? - -void* operator new(std::size_t size) -{ - return Nz::MemoryManager::Allocate(size, false); -} - -void* operator new[](std::size_t size) -{ - return Nz::MemoryManager::Allocate(size, true); -} - -void operator delete(void* pointer) noexcept -{ - Nz::MemoryManager::Free(pointer, false); -} - -void operator delete[](void* pointer) noexcept -{ - Nz::MemoryManager::Free(pointer, true); -} - -#endif // NAZARA_PHYSICS_MANAGE_MEMORY diff --git a/src/Nazara/Platform/Debug/NewOverload.cpp b/src/Nazara/Platform/Debug/NewOverload.cpp deleted file mode 100644 index 93a943986..000000000 --- a/src/Nazara/Platform/Debug/NewOverload.cpp +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright (C) 2022 Jérôme "Lynix" Leclercq (lynix680@gmail.com) -// This file is part of the "Nazara Engine - Platform module" -// For conditions of distribution and use, see copyright notice in Config.hpp - -#include -#if NAZARA_PLATFORM_MANAGE_MEMORY - -#include -#include // Needed ? - -void* operator new(std::size_t size) -{ - return Nz::MemoryManager::Allocate(size, false); -} - -void* operator new[](std::size_t size) -{ - return Nz::MemoryManager::Allocate(size, true); -} - -void operator delete(void* pointer) noexcept -{ - Nz::MemoryManager::Free(pointer, false); -} - -void operator delete[](void* pointer) noexcept -{ - Nz::MemoryManager::Free(pointer, true); -} - -#endif // NAZARA_PLATFORM_MANAGE_MEMORY diff --git a/src/Nazara/Renderer/Debug/NewOverload.cpp b/src/Nazara/Renderer/Debug/NewOverload.cpp deleted file mode 100644 index 4f94eab02..000000000 --- a/src/Nazara/Renderer/Debug/NewOverload.cpp +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright (C) 2022 Jérôme "Lynix" Leclercq (lynix680@gmail.com) -// This file is part of the "Nazara Engine - Renderer module" -// For conditions of distribution and use, see copyright notice in Config.hpp - -#include -#if NAZARA_RENDERER_MANAGE_MEMORY - -#include -#include // Nécessaire ? - -void* operator new(std::size_t size) -{ - return Nz::MemoryManager::Allocate(size, false); -} - -void* operator new[](std::size_t size) -{ - return Nz::MemoryManager::Allocate(size, true); -} - -void operator delete(void* pointer) noexcept -{ - Nz::MemoryManager::Free(pointer, false); -} - -void operator delete[](void* pointer) noexcept -{ - Nz::MemoryManager::Free(pointer, true); -} - -#endif // NAZARA_RENDERER_MANAGE_MEMORY diff --git a/src/Nazara/Utility/Debug/NewOverload.cpp b/src/Nazara/Utility/Debug/NewOverload.cpp deleted file mode 100644 index 4d0794327..000000000 --- a/src/Nazara/Utility/Debug/NewOverload.cpp +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright (C) 2022 Jérôme "Lynix" Leclercq (lynix680@gmail.com) -// This file is part of the "Nazara Engine - Utility module" -// For conditions of distribution and use, see copyright notice in Config.hpp - -#include -#if NAZARA_UTILITY_MANAGE_MEMORY - -#include -#include // Nécessaire ? - -void* operator new(std::size_t size) -{ - return Nz::MemoryManager::Allocate(size, false); -} - -void* operator new[](std::size_t size) -{ - return Nz::MemoryManager::Allocate(size, true); -} - -void operator delete(void* pointer) noexcept -{ - Nz::MemoryManager::Free(pointer, false); -} - -void operator delete[](void* pointer) noexcept -{ - Nz::MemoryManager::Free(pointer, true); -} - -#endif // NAZARA_UTILITY_MANAGE_MEMORY diff --git a/src/Nazara/VulkanRenderer/Debug/NewOverload.cpp b/src/Nazara/VulkanRenderer/Debug/NewOverload.cpp deleted file mode 100644 index 8c0b9a451..000000000 --- a/src/Nazara/VulkanRenderer/Debug/NewOverload.cpp +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright (C) 2022 Jérôme "Lynix" Leclercq (lynix680@gmail.com) -// This file is part of the "Nazara Engine - Vulkan renderer" -// For conditions of distribution and use, see copyright notice in Config.hpp - -#include -#if NAZARA_VULKANRENDERER_MANAGE_MEMORY - -#include -#include // Nécessaire ? - -void* operator new(std::size_t size) -{ - return Nz::MemoryManager::Allocate(size, false); -} - -void* operator new[](std::size_t size) -{ - return Nz::MemoryManager::Allocate(size, true); -} - -void operator delete(void* pointer) noexcept -{ - Nz::MemoryManager::Free(pointer, false); -} - -void operator delete[](void* pointer) noexcept -{ - Nz::MemoryManager::Free(pointer, true); -} - -#endif // NAZARA_VULKANRENDERER_MANAGE_MEMORY diff --git a/src/Nazara/Widgets/Debug/NewOverload.cpp b/src/Nazara/Widgets/Debug/NewOverload.cpp deleted file mode 100644 index 4624b38cc..000000000 --- a/src/Nazara/Widgets/Debug/NewOverload.cpp +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright (C) 2022 Jérôme "Lynix" Leclercq (lynix680@gmail.com) -// This file is part of the "Nazara Engine - Widgets module" -// For conditions of distribution and use, see copyright notice in Config.hpp - -#include -#if NAZARA_WIDGETS_MANAGE_MEMORY - -#include -#include // Nécessaire ? - -void* operator new(std::size_t size) -{ - return Nz::MemoryManager::Allocate(size, false); -} - -void* operator new[](std::size_t size) -{ - return Nz::MemoryManager::Allocate(size, true); -} - -void operator delete(void* pointer) noexcept -{ - Nz::MemoryManager::Free(pointer, false); -} - -void operator delete[](void* pointer) noexcept -{ - Nz::MemoryManager::Free(pointer, true); -} - -#endif