summaryrefslogtreecommitdiff
path: root/src/memory.cpp
diff options
context:
space:
mode:
authorJonathan Bradley <jcb@pikum.xyz>2023-11-28 12:17:03 -0500
committerJonathan Bradley <jcb@pikum.xyz>2023-11-28 12:17:03 -0500
commit99947625e8c81bedea910ae52da816dd942d52d9 (patch)
tree6579fd914b7060fdec61d65f48f223baa425a358 /src/memory.cpp
parentebcdf969c2388e97aee6ac3cde83510aab3e3238 (diff)
add a method to reset a memory bucket
Diffstat (limited to 'src/memory.cpp')
-rw-r--r--src/memory.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/memory.cpp b/src/memory.cpp
index c5d8375..f2b2ee3 100644
--- a/src/memory.cpp
+++ b/src/memory.cpp
@@ -48,6 +48,13 @@ int64_t InitNewBucket(int64_t sz, bool transient = false) {
return bucketHead++;
}
+void Pke_ResetBucket(MemBucket *bkt) {
+ bkt->head = 0;
+ bkt->lostBytes = 0;
+ bkt->allocs = 0;
+ bkt->lastEmptyBlockIndex = -1;
+}
+
void DestroyBucket(MemBucket *bkt) {
std::free(bkt->blocks);
bkt->size = 0;