From cdea6a178d4beb26a4ff1af84d8cd483f5419890 Mon Sep 17 00:00:00 2001 From: jatin Date: Wed, 19 Jun 2024 16:11:14 -0700 Subject: [PATCH] ArenaAllocator: fill re-claimed memory with byte pattern --- .../Allocators/chowdsp_ArenaAllocator.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/modules/common/chowdsp_data_structures/Allocators/chowdsp_ArenaAllocator.h b/modules/common/chowdsp_data_structures/Allocators/chowdsp_ArenaAllocator.h index 0dd66f8dd..455379cd6 100644 --- a/modules/common/chowdsp_data_structures/Allocators/chowdsp_ArenaAllocator.h +++ b/modules/common/chowdsp_data_structures/Allocators/chowdsp_ArenaAllocator.h @@ -2,6 +2,10 @@ #include +#ifndef ARENA_ALLOCATOR_DEBUG +#define ARENA_ALLOCATOR_DEBUG JUCE_DEBUG +#endif + namespace chowdsp { /** A simple arena allocator */ @@ -47,6 +51,10 @@ class ArenaAllocator */ void clear() noexcept { +#if ARENA_ALLOCATOR_DEBUG + std::fill (raw_data.begin(), raw_data.begin() + bytes_used, std::byte { 0xDD }); + std::fill (raw_data.begin() + bytes_used, raw_data.end(), std::byte { 0x00 }); +#endif bytes_used = 0; }