lib/mergeset: help GC by removing refereces to slices in inmemoryBlock.Reset

This commit is contained in:
Aliaksandr Valialkin 2020-11-25 21:19:43 +02:00
parent 8a057e705a
commit 7119f294f3

View File

@ -31,6 +31,12 @@ type inmemoryBlock struct {
func (ib *inmemoryBlock) Reset() {
ib.commonPrefix = ib.commonPrefix[:0]
ib.data = ib.data[:0]
items := ib.items
for i := range items {
// Remove reference to by slice, so GC could free the byte slice.
items[i] = nil
}
ib.items = ib.items[:0]
}