diff options
author | RĂ©mi Verschelde <remi@verschelde.fr> | 2022-08-02 15:54:18 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-08-02 15:54:18 +0200 |
commit | 33258d850cf6b40d9b20ba9643f98b3553c392c4 (patch) | |
tree | cb918e8226e14369c0ab37cf9969ab206ed747b2 /core/templates | |
parent | 4f8d31fc68c1b2276cbcbb62a308d59313b9fac6 (diff) | |
parent | b221eab4260c471c37ff2aae2546fcfa6dd7ac58 (diff) |
Merge pull request #61315 from lawnjelly/variant_bucket_pools
Variant memory pools
Diffstat (limited to 'core/templates')
-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(); } }; |