diff --git a/include/xo/arena/DArena.hpp b/include/xo/arena/DArena.hpp index 73ca67d..74f4832 100644 --- a/include/xo/arena/DArena.hpp +++ b/include/xo/arena/DArena.hpp @@ -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 diff --git a/src/arena/DArena.cpp b/src/arena/DArena.cpp index e5bbb11..ebee471 100644 --- a/src/arena/DArena.cpp +++ b/src/arena/DArena.cpp @@ -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 {