From b221eab4260c471c37ff2aae2546fcfa6dd7ac58 Mon Sep 17 00:00:00 2001 From: lawnjelly Date: Fri, 20 May 2022 13:28:44 +0100 Subject: Variant memory pools Memory pools via PagedAllocator for Transform2D, Transform3D, Basis and AABB. --- core/templates/paged_allocator.h | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'core/templates') 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 +#include template 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(); } }; -- cgit v1.2.3