From b5a6dc0a15518b54cc5d835c423c8cfa41de1eee Mon Sep 17 00:00:00 2001 From: sfan5 Date: Mon, 2 Jan 2023 20:37:18 +0100 Subject: [PATCH] Delete leak hunter --- include/IReferenceCounted.h | 10 ----- include/leakHunter.h | 70 ---------------------------------- source/Irrlicht/CMakeLists.txt | 1 - source/Irrlicht/leakHunter.cpp | 15 -------- 4 files changed, 96 deletions(-) delete mode 100644 include/leakHunter.h delete mode 100644 source/Irrlicht/leakHunter.cpp diff --git a/include/IReferenceCounted.h b/include/IReferenceCounted.h index 42dfc92..8a551e8 100644 --- a/include/IReferenceCounted.h +++ b/include/IReferenceCounted.h @@ -7,10 +7,6 @@ #include "irrTypes.h" -#ifdef _IRR_COMPILE_WITH_LEAK_HUNTER_ - #include "leakHunter.h" -#endif - namespace irr { @@ -50,17 +46,11 @@ namespace irr IReferenceCounted() : DebugName(0), ReferenceCounter(1) { -#ifdef _IRR_COMPILE_WITH_LEAK_HUNTER_ - LeakHunter::addObject(this); -#endif } //! Destructor. virtual ~IReferenceCounted() { - #ifdef _IRR_COMPILE_WITH_LEAK_HUNTER_ - LeakHunter::removeObject(this); - #endif } //! Grabs the object. Increments the reference counter by one. diff --git a/include/leakHunter.h b/include/leakHunter.h deleted file mode 100644 index 4e1ada4..0000000 --- a/include/leakHunter.h +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright (C) 2013 Michael Zeilfelder -// This file is part of the "Irrlicht Engine". -// For conditions of distribution and use, see copyright notice in irrlicht.h - -#ifndef __LEAK_HUNTER_INCLUDED__ -#define __LEAK_HUNTER_INCLUDED__ - -#include "IrrCompileConfig.h" - -#ifdef _IRR_COMPILE_WITH_LEAK_HUNTER_ - -#include "irrArray.h" - -namespace irr -{ - class IReferenceCounted; - - //! A class helping to find unreleased objects of type IReferenceCounted. - /** To use this you have recompile Irrlicht with _IRR_COMPILE_WITH_LEAK_HUNTER_. - Note that this will slow down your application and should only be used for debugging. - The way to use is that you can check after you closed and dropped your last Irrlicht device - if there are still any IReferenceCounted left over which have not been deleted. - */ - class LeakHunter - { - public: - friend class IReferenceCounted; - - //! Clear all IReferenceCounted objects inside LeakHunter - /** This does not affect the IReferenceCounted themselves only the - counting of them. Usually you don't ever need to clear, but - sometimes it helps when for example you want to ignore - certain leaks. - */ - static void clearReferenceCountedObjects() - { - ReferenceCountedObjects.clear(); - } - - //! Access all objects which are currently reference counted. - static inline irr::core::array getReferenceCountedObjects() - { - return ReferenceCountedObjects; - } - - protected: - static inline void addObject(const IReferenceCounted* object) - { - ReferenceCountedObjects.push_back(object); - } - - static inline void removeObject(const IReferenceCounted* object) - { - irr::s32 idx = ReferenceCountedObjects.linear_search(object ); - if ( idx >= 0 ) - { - irr::core::swap( ReferenceCountedObjects[idx], ReferenceCountedObjects.getLast() ); - ReferenceCountedObjects.erase( ReferenceCountedObjects.size()-1 ); - } - } - - private: - // NOTE: We don't do additional grab()/drop()'s here as we want to supervise reference counted objects and not affect them otherwise. - IRRLICHT_API static irr::core::array ReferenceCountedObjects; - }; -} // end namespace irr - -#endif // _IRR_COMPILE_WITH_LEAK_HUNTER_ - -#endif diff --git a/source/Irrlicht/CMakeLists.txt b/source/Irrlicht/CMakeLists.txt index 57a4304..2a3045c 100644 --- a/source/Irrlicht/CMakeLists.txt +++ b/source/Irrlicht/CMakeLists.txt @@ -241,7 +241,6 @@ add_library(IRROTHEROBJ OBJECT COSOperator.cpp Irrlicht.cpp os.cpp - leakHunter.cpp CProfiler.cpp ) diff --git a/source/Irrlicht/leakHunter.cpp b/source/Irrlicht/leakHunter.cpp deleted file mode 100644 index 4935767..0000000 --- a/source/Irrlicht/leakHunter.cpp +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright (C) 2013 Michael Zeilfelder -// This file is part of the "Irrlicht Engine". -// For conditions of distribution and use, see copyright notice in irrlicht.h - -#include "leakHunter.h" - -#ifdef _IRR_COMPILE_WITH_LEAK_HUNTER_ - -namespace irr -{ - irr::core::array LeakHunter::ReferenceCountedObjects; -} // end namespace irr - -#endif // _IRR_COMPILE_WITH_LEAK_HUNTER_ -