Remove "MemoryManager" and very old code
This commit is contained in:
@@ -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 <Nazara/Audio/Config.hpp>
|
||||
#if NAZARA_AUDIO_MANAGE_MEMORY
|
||||
|
||||
#include <Nazara/Core/MemoryManager.hpp>
|
||||
#include <new> // 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
|
||||
@@ -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<SoundBuffer> buffer)
|
||||
{
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
@@ -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 <Nazara/Core/Config.hpp>
|
||||
#if NAZARA_CORE_MANAGE_MEMORY
|
||||
|
||||
#include <Nazara/Core/MemoryManager.hpp>
|
||||
#include <new> // 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
|
||||
@@ -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 <Nazara/Core/Config.hpp>
|
||||
#if NAZARA_CORE_MANAGE_MEMORY
|
||||
|
||||
#include <Nazara/Core/MemoryManager.hpp>
|
||||
#include <new> // Nécessaire ?
|
||||
|
||||
#define NAZARA_DEBUG_NEWREDEFINITION_DISABLE_REDEFINITION
|
||||
#include <Nazara/Core/Debug/NewRedefinition.hpp>
|
||||
|
||||
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
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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 <Nazara/Core/MemoryManager.hpp>
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
#include <ctime>
|
||||
#include <new>
|
||||
|
||||
#if defined(NAZARA_PLATFORM_WINDOWS)
|
||||
#include <windows.h>
|
||||
#elif defined(NAZARA_PLATFORM_POSIX)
|
||||
#include <pthread.h>
|
||||
#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<Block*>(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<UInt8*>(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<UInt8*>(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<Block*>(static_cast<UInt8*>(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<UInt8*>(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<UInt8*>(ptr) + sizeof(Block), ptr->size, ptr->file, ptr->line);
|
||||
else
|
||||
std::fprintf(log, "-0x%s -> %zu bytes allocated at unknown position\n", reinterpret_cast<UInt8*>(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 <Nazara/Core/AntiWindows.hpp>
|
||||
#endif
|
||||
@@ -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 <Nazara/Graphics/Config.hpp>
|
||||
#if NAZARA_GRAPHICS_MANAGE_MEMORY
|
||||
|
||||
#include <Nazara/Core/MemoryManager.hpp>
|
||||
#include <new> // 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
|
||||
@@ -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 <Nazara/Network/Config.hpp>
|
||||
#if NAZARA_NETWORK_MANAGE_MEMORY
|
||||
|
||||
#include <Nazara/Core/MemoryManager.hpp>
|
||||
#include <new> // 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
|
||||
@@ -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 <Nazara/OpenGLRenderer/Config.hpp>
|
||||
#if NAZARA_OPENGLRENDERER_MANAGE_MEMORY
|
||||
|
||||
#include <Nazara/Core/MemoryManager.hpp>
|
||||
#include <new> // 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
|
||||
@@ -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 <Nazara/Physics2D/Config.hpp>
|
||||
#if NAZARA_PHYSICS2D_MANAGE_MEMORY
|
||||
|
||||
#include <Nazara/Core/MemoryManager.hpp>
|
||||
#include <new> // 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
|
||||
@@ -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 <Nazara/Physics3D/Config.hpp>
|
||||
#if NAZARA_PHYSICS3D_MANAGE_MEMORY
|
||||
|
||||
#include <Nazara/Core/MemoryManager.hpp>
|
||||
#include <new> // 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
|
||||
@@ -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 <Nazara/Platform/Config.hpp>
|
||||
#if NAZARA_PLATFORM_MANAGE_MEMORY
|
||||
|
||||
#include <Nazara/Core/MemoryManager.hpp>
|
||||
#include <new> // 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
|
||||
@@ -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 <Nazara/Renderer/Config.hpp>
|
||||
#if NAZARA_RENDERER_MANAGE_MEMORY
|
||||
|
||||
#include <Nazara/Core/MemoryManager.hpp>
|
||||
#include <new> // 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
|
||||
@@ -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 <Nazara/Utility/Config.hpp>
|
||||
#if NAZARA_UTILITY_MANAGE_MEMORY
|
||||
|
||||
#include <Nazara/Core/MemoryManager.hpp>
|
||||
#include <new> // 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
|
||||
@@ -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 <Nazara/VulkanRenderer/Config.hpp>
|
||||
#if NAZARA_VULKANRENDERER_MANAGE_MEMORY
|
||||
|
||||
#include <Nazara/Core/MemoryManager.hpp>
|
||||
#include <new> // 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
|
||||
@@ -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 <Nazara/Widgets/Config.hpp>
|
||||
#if NAZARA_WIDGETS_MANAGE_MEMORY
|
||||
|
||||
#include <Nazara/Core/MemoryManager.hpp>
|
||||
#include <new> // 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
|
||||
Reference in New Issue
Block a user