xo-alloc2: + DArena.scrub() for diagnostics
This commit is contained in:
parent
4c80ff9396
commit
de52b3b5dd
2 changed files with 9 additions and 0 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue