NazaraEngine/include/Nazara/Core/Debug/MemoryLeakTracker.hpp

36 lines
1.1 KiB
C++

// Copyright (C) 2012 Jérôme Leclercq
// 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
#include <Nazara/Prerequesites.hpp>
#include <cstdio>
#include <cstring>
class NAZARA_API NzMemoryManager
{
public:
NzMemoryManager();
~NzMemoryManager();
static void* Allocate(std::size_t size, bool multi, const char* file = nullptr, unsigned int line = 0);
static void Free(void* pointer, bool multi);
static void NextFree(const char* file, unsigned int line);
private:
static void Initialize();
static char* TimeInfo();
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();
#endif // NAZARA_DEBUG_MEMORYLEAKTRACKER_HPP