From bf53622b19d29ef771153e2214d78e7ef2bb4a13 Mon Sep 17 00:00:00 2001 From: Patrick Wuttke Date: Wed, 2 Jul 2025 16:40:46 +0200 Subject: [PATCH] Added missing construction and destruction of StackAllocatorSnapshotData, which is only required when MIJIN_STACK_ALLOCATOR_DEBUG is 2. --- source/mijin/memory/stack_allocator.hpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/source/mijin/memory/stack_allocator.hpp b/source/mijin/memory/stack_allocator.hpp index c92bd2f..745e01a 100644 --- a/source/mijin/memory/stack_allocator.hpp +++ b/source/mijin/memory/stack_allocator.hpp @@ -326,6 +326,7 @@ public: // couldn't allocate the snapshot return {}; } + ::new (snapshotData) StackAllocatorSnapshotData; StackAllocatorSnapshot snapshot; snapshot.data = snapshotData; if (firstChunk_ != prevFirst) @@ -442,6 +443,7 @@ public: Chunk* snapshotChunk = findChunk(snapshot.data); MIJIN_ASSERT_FATAL(snapshotChunk != nullptr, "Snapshot not in chunks?"); snapshotChunk->allocated -= calcSnapshotSize(snapshot->numChunks); // note: this might miss the alignment bytes of the snapshot, but that should be fine + snapshot.data->~StackAllocatorSnapshotData(); } private: void initAndAddChunk(Chunk* newChunk) noexcept