Skip to content

Commit 49a89c4

Browse files
committed
Do not overshoot iterator allocations
1 parent 973ec98 commit 49a89c4

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

crates/partition-store/src/owned_iter.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ impl<'a, DB: DBAccess> OwnedIterator<'a, DB> {
2020
pub(crate) fn new(iter: DBRawIteratorWithThreadMode<'a, DB>) -> Self {
2121
Self {
2222
iter,
23-
arena: BytesMut::with_capacity(8196),
23+
arena: BytesMut::new(),
2424
}
2525
}
2626
}
@@ -30,9 +30,8 @@ impl<DB: DBAccess> Iterator for OwnedIterator<'_, DB> {
3030

3131
#[inline]
3232
fn next(&mut self) -> Option<Self::Item> {
33-
self.arena.reserve(8192);
34-
3533
if let Some((k, v)) = self.iter.item() {
34+
self.arena.reserve(k.len() + v.len());
3635
self.arena.put_slice(k);
3736
let key = self.arena.split().freeze();
3837
self.arena.put_slice(v);

0 commit comments

Comments
 (0)