From 3d8a808b218edaa046a0028c48269c8b1d00ec05 Mon Sep 17 00:00:00 2001 From: Vladislav Belov Date: Thu, 22 Oct 2026 23:22:35 +0200 Subject: [PATCH] Replaces DynamicArena by LinearAllocator for GUI Also DynamicArena causes an assertion when there are too many GUI elements. LinearAllocator consumes similar amount of memory in total but reduces a chance to get the assertion. --- source/gui/GUIObjectEventBroadcaster.h | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/source/gui/GUIObjectEventBroadcaster.h b/source/gui/GUIObjectEventBroadcaster.h index 5f5311633e..0bc14e259e 100644 --- a/source/gui/GUIObjectEventBroadcaster.h +++ b/source/gui/GUIObjectEventBroadcaster.h @@ -22,8 +22,8 @@ #include "gui/ObjectBases/IGUIObject.h" #include "lib/alignment.h" -#include "lib/allocators/DynamicArena.h" #include "ps/memory/AllocatorAdapter.h" +#include "ps/memory/LinearAllocator.h" #include #include @@ -59,11 +59,10 @@ public: template static void RecurseVisibleObject(IGUIObject* object, void(IGUIObject::* callbackFunction)(Args... args), Args&&... args) { - using Arena = Allocators::DynamicArena<128 * KiB>; - using ObjectListAllocator = PS::Memory::AllocatorAdapter; - Arena arena; + PS::Memory::LinearAllocator allocator{128 * KiB, 4 * MiB}; + using ObjectListAllocator = PS::Memory::AllocatorAdapter; - std::vector visibleObjects((ObjectListAllocator(arena))); + std::vector visibleObjects((ObjectListAllocator(allocator))); CollectVisibleObjectsRecursively(object->GetVisibleChildren(), &visibleObjects); for (VisibleObject& visibleObject : visibleObjects) visibleObject.bufferedZ = visibleObject.object->GetBufferedZ();