Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ArenaAllocator: fill re-claimed memory with byte pattern #542

Merged
merged 1 commit into from
Jun 19, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading