Updated MemoryManager
Renamed MemoryLeakTracker[.hpp|.cpp] to MemoryManager[.hpp|.cpp] Added MemoryManager::GetAllocatedBlockCount() Added MemoryManager::GetAllocatedSize() Optimized MemoryManager (no longer allocates a time buffer) Former-commit-id: 0e9c720cbb48fbed7006db3bd1000ebbc22c9583
This commit is contained in:
@@ -29,8 +29,8 @@
|
||||
|
||||
/// Chaque modification d'un paramètre du module nécessite une recompilation de celui-ci
|
||||
|
||||
// Utilise un tracker pour repérer les éventuels leaks (Ralentit l'exécution)
|
||||
#define NAZARA_AUDIO_MEMORYLEAKTRACKER 0
|
||||
// Utilise un manager de mémoire pour gérer les allocations dynamiques (détecte les leaks, ralenti l'exécution)
|
||||
#define NAZARA_AUDIO_MEMORYMANAGER 0
|
||||
|
||||
// Active les tests de sécurité basés sur le code (Conseillé pour le développement)
|
||||
#define NAZARA_AUDIO_SAFE 1
|
||||
|
||||
@@ -3,6 +3,6 @@
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
#include <Nazara/Audio/Config.hpp>
|
||||
#if NAZARA_AUDIO_MEMORYLEAKTRACKER || defined(NAZARA_DEBUG)
|
||||
#include <Nazara/Core/Debug/MemoryLeakTracker.hpp>
|
||||
#if NAZARA_AUDIO_MEMORYMANAGER || defined(NAZARA_DEBUG)
|
||||
#include <Nazara/Core/Debug/MemoryManager.hpp>
|
||||
#endif
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// This file is part of the "Nazara Engine - Audio module"
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
#if NAZARA_AUDIO_MEMORYLEAKTRACKER || defined(NAZARA_DEBUG)
|
||||
#if NAZARA_AUDIO_MEMORYMANAGER || defined(NAZARA_DEBUG)
|
||||
#undef delete
|
||||
#undef new
|
||||
#endif
|
||||
|
||||
@@ -44,8 +44,8 @@
|
||||
// Incorpore la table Unicode Character Data (Nécessaires pour faire fonctionner le flag NzString::HandleUTF8)
|
||||
#define NAZARA_CORE_INCLUDE_UNICODEDATA 0
|
||||
|
||||
// Utilise un tracker pour repérer les éventuels leaks (Ralentit l'exécution)
|
||||
#define NAZARA_CORE_MEMORYLEAKTRACKER 0
|
||||
// Utilise un manager de mémoire pour gérer les allocations dynamiques (détecte les leaks, ralenti l'exécution)
|
||||
#define NAZARA_CORE_MEMORYMANAGER 0
|
||||
|
||||
// Précision des réels lors de la transformation en texte (Max. chiffres après la virgule)
|
||||
#define NAZARA_CORE_REAL_PRECISION 6
|
||||
|
||||
@@ -3,6 +3,6 @@
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
#include <Nazara/Core/Config.hpp>
|
||||
#if NAZARA_CORE_MEMORYLEAKTRACKER || defined(NAZARA_DEBUG)
|
||||
#include <Nazara/Core/Debug/MemoryLeakTracker.hpp>
|
||||
#if NAZARA_CORE_MEMORYMANAGER || defined(NAZARA_DEBUG)
|
||||
#include <Nazara/Core/Debug/MemoryManager.hpp>
|
||||
#endif
|
||||
|
||||
@@ -2,10 +2,8 @@
|
||||
// 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_DEBUG_MEMORYLEAKTRACKER_HPP
|
||||
#define NAZARA_DEBUG_MEMORYLEAKTRACKER_HPP
|
||||
#ifndef NAZARA_DEBUG_MEMORYMANAGER_HPP
|
||||
#define NAZARA_DEBUG_MEMORYMANAGER_HPP
|
||||
|
||||
#include <Nazara/Prerequesites.hpp>
|
||||
#include <cstdio>
|
||||
@@ -15,7 +13,12 @@ class NAZARA_API NzMemoryManager
|
||||
{
|
||||
public:
|
||||
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 unsigned int GetAllocatedBlockCount();
|
||||
static std::size_t GetAllocatedSize();
|
||||
|
||||
static void NextFree(const char* file, unsigned int line);
|
||||
|
||||
private:
|
||||
@@ -23,18 +26,18 @@ class NAZARA_API NzMemoryManager
|
||||
~NzMemoryManager();
|
||||
|
||||
static void Initialize();
|
||||
static char* TimeInfo();
|
||||
static void TimeInfo(char buffer[23]);
|
||||
static void Uninitialize();
|
||||
};
|
||||
|
||||
NAZARA_API void* operator new(std::size_t size, const char* file, unsigned int line);
|
||||
NAZARA_API void* operator new[](std::size_t size, const char* file, unsigned int line);
|
||||
NAZARA_API void operator delete(void* ptr, const char* file, unsigned int line) throw();
|
||||
NAZARA_API void operator delete[](void* ptr, const char* file, unsigned int line) throw();
|
||||
NAZARA_API void operator delete(void* ptr, const char* file, unsigned int line) noexcept;
|
||||
NAZARA_API void operator delete[](void* ptr, const char* file, unsigned int line) noexcept;
|
||||
|
||||
#endif // NAZARA_DEBUG_MEMORYLEAKTRACKER_HPP
|
||||
#endif // NAZARA_DEBUG_MEMORYMANAGER_HPP
|
||||
|
||||
#ifndef NAZARA_DEBUG_MEMORYLEAKTRACKER_DISABLE_REDEFINITION
|
||||
#ifndef NAZARA_DEBUG_MEMORYMANAGER_DISABLE_REDEFINITION
|
||||
#define delete NzMemoryManager::NextFree(__FILE__, __LINE__), delete
|
||||
#define new new(__FILE__, __LINE__)
|
||||
#endif
|
||||
@@ -2,7 +2,7 @@
|
||||
// This file is part of the "Nazara Engine - Core module"
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
#if NAZARA_CORE_MEMORYLEAKTRACKER || defined(NAZARA_DEBUG)
|
||||
#if NAZARA_CORE_MEMORYMANAGER || defined(NAZARA_DEBUG)
|
||||
#undef delete
|
||||
#undef new
|
||||
#endif
|
||||
|
||||
@@ -32,8 +32,8 @@
|
||||
// À partir de combien d'instances d'un même mesh/matériau l'instancing doit-il être utilisé ?
|
||||
#define NAZARA_GRAPHICS_INSTANCING_MIN_INSTANCES_COUNT 10
|
||||
|
||||
// Utilise un tracker pour repérer les éventuels leaks (Ralentit l'exécution)
|
||||
#define NAZARA_GRAPHICS_MEMORYLEAKTRACKER 0
|
||||
// Utilise un manager de mémoire pour gérer les allocations dynamiques (détecte les leaks, ralenti l'exécution)
|
||||
#define NAZARA_GRAPHICS_MEMORYMANAGER 0
|
||||
|
||||
// Active les tests de sécurité basés sur le code (Conseillé pour le développement)
|
||||
#define NAZARA_GRAPHICS_SAFE 1
|
||||
|
||||
@@ -3,6 +3,6 @@
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
#include <Nazara/Graphics/Config.hpp>
|
||||
#if NAZARA_GRAPHICS_MEMORYLEAKTRACKER || defined(NAZARA_DEBUG)
|
||||
#include <Nazara/Core/Debug/MemoryLeakTracker.hpp>
|
||||
#if NAZARA_GRAPHICS_MEMORYMANAGER || defined(NAZARA_DEBUG)
|
||||
#include <Nazara/Core/Debug/MemoryManager.hpp>
|
||||
#endif
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// This file is part of the "Nazara Engine - Graphics module"
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
#if NAZARA_GRAPHICS_MEMORYLEAKTRACKER || defined(NAZARA_DEBUG)
|
||||
#if NAZARA_GRAPHICS_MEMORYMANAGER || defined(NAZARA_DEBUG)
|
||||
#undef delete
|
||||
#undef new
|
||||
#endif
|
||||
|
||||
@@ -29,8 +29,8 @@
|
||||
|
||||
/// Chaque modification d'un paramètre du module nécessite une recompilation de celui-ci
|
||||
|
||||
// Utilise un tracker pour repérer les éventuels leaks (Ralentit l'exécution)
|
||||
#define NAZARA_LUA_MEMORYLEAKTRACKER 0
|
||||
// Utilise un manager de mémoire pour gérer les allocations dynamiques (détecte les leaks, ralenti l'exécution)
|
||||
#define NAZARA_LUA_MEMORYMANAGER 0
|
||||
|
||||
// Active les tests de sécurité basés sur le code (Conseillé pour le développement)
|
||||
#define NAZARA_LUA_SAFE 1
|
||||
|
||||
@@ -3,6 +3,6 @@
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
#include <Nazara/Lua/Config.hpp>
|
||||
#if NAZARA_LUA_MEMORYLEAKTRACKER || defined(NAZARA_DEBUG)
|
||||
#include <Nazara/Core/Debug/MemoryLeakTracker.hpp>
|
||||
#if NAZARA_LUA_MEMORYMANAGER || defined(NAZARA_DEBUG)
|
||||
#include <Nazara/Core/Debug/MemoryManager.hpp>
|
||||
#endif
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// This file is part of the "Nazara Engine - Lua scripting module"
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
#if NAZARA_LUA_MEMORYLEAKTRACKER || defined(NAZARA_DEBUG)
|
||||
#if NAZARA_LUA_MEMORYMANAGER || defined(NAZARA_DEBUG)
|
||||
#undef delete
|
||||
#undef new
|
||||
#endif
|
||||
|
||||
@@ -29,8 +29,8 @@
|
||||
|
||||
/// Chaque modification d'un paramètre du module nécessite une recompilation de celui-ci
|
||||
|
||||
// Utilise un tracker pour repérer les éventuels leaks (Ralentit l'exécution)
|
||||
#define NAZARA_NOISE_MEMORYLEAKTRACKER 0
|
||||
// Utilise un manager de mémoire pour gérer les allocations dynamiques (détecte les leaks, ralenti l'exécution)
|
||||
#define NAZARA_NOISE_MEMORYMANAGER 0
|
||||
|
||||
// Active les tests de sécurité basés sur le code (Conseillé pour le développement)
|
||||
#define NAZARA_NOISE_SAFE 1
|
||||
|
||||
@@ -3,6 +3,6 @@
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
#include <Nazara/Noise/Config.hpp>
|
||||
#if NAZARA_NOISE_MEMORYLEAKTRACKER || defined(NAZARA_DEBUG)
|
||||
#include <Nazara/Core/Debug/MemoryLeakTracker.hpp>
|
||||
#if NAZARA_NOISE_MEMORYMANAGER || defined(NAZARA_DEBUG)
|
||||
#include <Nazara/Core/Debug/MemoryManager.hpp>
|
||||
#endif
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// This file is part of the "Nazara Engine - Noise module"
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
#if NAZARA_NOISE_MEMORYLEAKTRACKER || defined(NAZARA_DEBUG)
|
||||
#if NAZARA_NOISE_MEMORYMANAGER || defined(NAZARA_DEBUG)
|
||||
#undef delete
|
||||
#undef new
|
||||
#endif
|
||||
|
||||
@@ -29,8 +29,8 @@
|
||||
|
||||
/// Chaque modification d'un paramètre du module nécessite une recompilation de celui-ci
|
||||
|
||||
// Utilise un tracker pour repérer les éventuels leaks (Ralentit l'exécution)
|
||||
#define NAZARA_PHYSICS_MEMORYLEAKTRACKER 0
|
||||
// Utilise un manager de mémoire pour gérer les allocations dynamiques (détecte les leaks, ralenti l'exécution)
|
||||
#define NAZARA_PHYSICS_MEMORYMANAGER 0
|
||||
|
||||
// Active les tests de sécurité basés sur le code (Conseillé pour le développement)
|
||||
#define NAZARA_PHYSICS_SAFE 1
|
||||
|
||||
@@ -3,6 +3,6 @@
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
#include <Nazara/Physics/Config.hpp>
|
||||
#if NAZARA_PHYSICS_MEMORYLEAKTRACKER || defined(NAZARA_DEBUG)
|
||||
#include <Nazara/Core/Debug/MemoryLeakTracker.hpp>
|
||||
#if NAZARA_PHYSICS_MEMORYMANAGER || defined(NAZARA_DEBUG)
|
||||
#include <Nazara/Core/Debug/MemoryManager.hpp>
|
||||
#endif
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// This file is part of the "Nazara Engine - Physics module"
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
#if NAZARA_PHYSICS_MEMORYLEAKTRACKER || defined(NAZARA_DEBUG)
|
||||
#if NAZARA_PHYSICS_MEMORYMANAGER || defined(NAZARA_DEBUG)
|
||||
#undef delete
|
||||
#undef new
|
||||
#endif
|
||||
|
||||
@@ -32,8 +32,8 @@
|
||||
// La taille du buffer d'Instancing (définit le nombre maximum d'instances en un rendu)
|
||||
#define NAZARA_RENDERER_INSTANCE_BUFFER_SIZE 8192*64 // 8192 matrices 4x4 flottantes
|
||||
|
||||
// Utilise un tracker pour repérer les éventuels leaks (Ralentit l'exécution)
|
||||
#define NAZARA_RENDERER_MEMORYLEAKTRACKER 0
|
||||
// Utilise un manager de mémoire pour gérer les allocations dynamiques (détecte les leaks, ralenti l'exécution)
|
||||
#define NAZARA_RENDERER_MEMORYMANAGER 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
|
||||
|
||||
@@ -3,6 +3,6 @@
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
#include <Nazara/Renderer/Config.hpp>
|
||||
#if NAZARA_RENDERER_MEMORYLEAKTRACKER || defined(NAZARA_DEBUG)
|
||||
#include <Nazara/Core/Debug/MemoryLeakTracker.hpp>
|
||||
#if NAZARA_RENDERER_MEMORYMANAGER || defined(NAZARA_DEBUG)
|
||||
#include <Nazara/Core/Debug/MemoryManager.hpp>
|
||||
#endif
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// This file is part of the "Nazara Engine - Renderer module"
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
#if NAZARA_RENDERER_MEMORYLEAKTRACKER || defined(NAZARA_DEBUG)
|
||||
#if NAZARA_RENDERER_MEMORYMANAGER || defined(NAZARA_DEBUG)
|
||||
#undef delete
|
||||
#undef new
|
||||
#endif
|
||||
|
||||
@@ -32,8 +32,8 @@
|
||||
// Force les buffers à posséder un stride multiple de 32 bytes (Gain de performances sur certaines cartes/plus de consommation mémoire)
|
||||
#define NAZARA_UTILITY_FORCE_DECLARATION_STRIDE_MULTIPLE_OF_32 0 ///FIXME: Ne peut pas être utilisé pour l'instant
|
||||
|
||||
// Utilise un tracker pour repérer les éventuels leaks (Ralentit l'exécution)
|
||||
#define NAZARA_UTILITY_MEMORYLEAKTRACKER 0
|
||||
// Utilise un manager de mémoire pour gérer les allocations dynamiques (détecte les leaks, ralenti l'exécution)
|
||||
#define NAZARA_UTILITY_MEMORYMANAGER 0
|
||||
|
||||
// Le skinning doit-il prendre avantage du multi-threading ? (Boost de performances sur les processeurs multi-coeurs)
|
||||
#define NAZARA_UTILITY_MULTITHREADED_SKINNING 0
|
||||
|
||||
@@ -3,6 +3,6 @@
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
#include <Nazara/Utility/Config.hpp>
|
||||
#if NAZARA_UTILITY_MEMORYLEAKTRACKER || defined(NAZARA_DEBUG)
|
||||
#include <Nazara/Core/Debug/MemoryLeakTracker.hpp>
|
||||
#if NAZARA_UTILITY_MEMORYMANAGER || defined(NAZARA_DEBUG)
|
||||
#include <Nazara/Core/Debug/MemoryManager.hpp>
|
||||
#endif
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// This file is part of the "Nazara Engine - Utility module"
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
#if NAZARA_UTILITY_MEMORYLEAKTRACKER || defined(NAZARA_DEBUG)
|
||||
#if NAZARA_UTILITY_MEMORYMANAGER || defined(NAZARA_DEBUG)
|
||||
#undef delete
|
||||
#undef new
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user