Skip to content

Commit 38fb051

Browse files
committed
compact: save the resized valueBuf when saving values
Previously saveValue would copy the current iteration value into valueBuf, but if valueBuf was grown to accommodate a larger value, valueBuf wasn't stored. This lead to repeated re-allocations of buffers sufficiently large to hold the iteration value.
1 parent ce9b648 commit 38fb051

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

internal/compact/iterator.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1294,7 +1294,8 @@ func (i *Iter) saveValue() {
12941294
i.err = err
12951295
i.value = base.LazyValue{}
12961296
} else if !callerOwned {
1297-
i.value = base.MakeInPlaceValue(append(i.valueBuf[:0], v...))
1297+
i.valueBuf = append(i.valueBuf[:0], v...)
1298+
i.value = base.MakeInPlaceValue(i.valueBuf)
12981299
} else {
12991300
i.value = base.MakeInPlaceValue(v)
13001301
}

0 commit comments

Comments
 (0)