diff options
author | lawnjelly <lawnjelly@gmail.com> | 2022-05-20 13:28:44 +0100 |
---|---|---|
committer | lawnjelly <lawnjelly@gmail.com> | 2022-07-04 12:01:46 +0100 |
commit | b221eab4260c471c37ff2aae2546fcfa6dd7ac58 (patch) | |
tree | bdbf944f69d8a193c5a76160e314cf112ef310f2 /core/templates/paged_allocator.h | |
parent | 1d06fec5354d45c21414bf4b00435868444636cb (diff) |
Variant memory pools
Memory pools via PagedAllocator for Transform2D, Transform3D, Basis and AABB.
Diffstat (limited to 'core/templates/paged_allocator.h')
-rw-r--r-- | core/templates/paged_allocator.h | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/core/templates/paged_allocator.h b/core/templates/paged_allocator.h index cf5911a847..43aab052fd 100644 --- a/core/templates/paged_allocator.h +++ b/core/templates/paged_allocator.h @@ -31,11 +31,14 @@ #ifndef PAGED_ALLOCATOR_H #define PAGED_ALLOCATOR_H +#include "core/core_globals.h" #include "core/os/memory.h" #include "core/os/spin_lock.h" +#include "core/string/ustring.h" #include "core/typedefs.h" #include <type_traits> +#include <typeinfo> template <class T, bool thread_safe = false> class PagedAllocator { @@ -132,7 +135,12 @@ public: } ~PagedAllocator() { - ERR_FAIL_COND_MSG(allocs_available < pages_allocated * page_size, "Pages in use exist at exit in PagedAllocator"); + if (allocs_available < pages_allocated * page_size) { + if (CoreGlobals::leak_reporting_enabled) { + ERR_FAIL_COND_MSG(allocs_available < pages_allocated * page_size, String("Pages in use exist at exit in PagedAllocator: ") + String(typeid(T).name())); + } + return; + } reset(); } }; |