Skip to content

Commit

Permalink
ArenaAllocator: fill re-claimed memory with byte pattern (#542)
Browse files Browse the repository at this point in the history
  • Loading branch information
jatinchowdhury18 authored Jun 19, 2024
1 parent e4d6a5b commit 46a3d79
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

#include <vector>

#ifndef ARENA_ALLOCATOR_DEBUG
#define ARENA_ALLOCATOR_DEBUG JUCE_DEBUG
#endif

namespace chowdsp
{
/** A simple arena allocator */
Expand Down Expand Up @@ -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;
}

Expand Down

0 comments on commit 46a3d79

Please sign in to comment.