Remove "MemoryManager" and very old code
This commit is contained in:
@@ -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 <Nazara/Core/ConfigCheck.hpp>
|
||||
|
||||
|
||||
@@ -12,15 +12,8 @@
|
||||
#include <type_traits>
|
||||
#define NazaraCheckTypeAndVal(name, type, op, val, err) static_assert(std::is_ ##type <decltype(name)>::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
|
||||
|
||||
|
||||
@@ -3,8 +3,3 @@
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
// no header guards
|
||||
|
||||
#include <Nazara/Core/Config.hpp>
|
||||
#if NAZARA_CORE_MANAGE_MEMORY
|
||||
#include <Nazara/Core/Debug/NewRedefinition.hpp>
|
||||
#endif
|
||||
|
||||
@@ -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 <Nazara/Core/Config.hpp>
|
||||
|
||||
#if NAZARA_CORE_MANAGE_MEMORY
|
||||
|
||||
#ifndef NAZARA_CORE_DEBUG_NEWREDEFINITION_HPP
|
||||
#define NAZARA_CORE_DEBUG_NEWREDEFINITION_HPP
|
||||
|
||||
#include <Nazara/Prerequisites.hpp>
|
||||
#include <Nazara/Core/MemoryManager.hpp>
|
||||
|
||||
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
|
||||
@@ -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
|
||||
|
||||
@@ -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 <Nazara/Prerequisites.hpp>
|
||||
#include <Nazara/Core/Config.hpp>
|
||||
#include <cstddef>
|
||||
|
||||
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
|
||||
Reference in New Issue
Block a user