Update to MemoryUsage worker

This commit is contained in:
Aditya Ujeniya
2026-01-16 17:01:39 +01:00
parent eb09504306
commit 77a2a256e4
4 changed files with 52 additions and 13 deletions

View File

@@ -234,9 +234,12 @@ func (l *Level) forceFree() (int, error) {
// If delme is true, it means 'b' itself (the head) was the oldest
// and needs to be removed from the slice.
if delme {
if cap(b.data) == BufferCap {
bufferPool.Put(b)
}
// Nil out fields to ensure no hanging references
b.next = nil
b.prev = nil
b.data = nil
l.metrics[i] = nil
}
}