Skip to content

Commit

Permalink
ArenaAllocator: fill re-claimed memory with byte pattern
Browse files Browse the repository at this point in the history
  • Loading branch information
jatinchowdhury18 committed Jun 19, 2024
1 parent c3ddb33 commit cdea6a1
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 cdea6a1

Please sign in to comment.