xo-alloc2: + DArena.scrub() for diagnostics

This commit is contained in:
Roland Conybeare 2026-03-24 22:15:53 -04:00
commit de52b3b5dd
2 changed files with 9 additions and 0 deletions

View file

@ -229,6 +229,9 @@ namespace xo {
void restore(Checkpoint ckp) noexcept { free_ = ckp.free_; }
/** zero out all allocated memory. Likely use case is diagnostics **/
void scrub() noexcept;
/** discard all allocated memory, return to empty state
* Promise:
* - committed memory unchanged

View file

@ -583,6 +583,12 @@ namespace xo {
return true;
} /*expand*/
void
DArena::scrub() noexcept
{
::memset(this->lo_, 0, this->free_ - this->lo_);
}
void
DArena::clear() noexcept
{