Skip to content

Commit

Permalink
fix: allocate much memory for residual vectors than needed (#3446)
Browse files Browse the repository at this point in the history
Signed-off-by: BubbleCal <[email protected]>
  • Loading branch information
BubbleCal authored Feb 13, 2025
1 parent 7687558 commit a6101e5
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion rust/lance-index/src/vector/residual.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,10 @@ where
let c = &centroids_slice[part_id * dimension..(part_id + 1) * dimension];
iter::zip(vector, c).map(|(v, cent)| *v - *cent)
})
.exact_size(vectors.len() * dimension)
.exact_size(vectors.len())
.collect::<Vec<_>>();
let residual_arr = PrimitiveArray::<T>::from_iter_values(residuals);
debug_assert_eq!(residual_arr.len(), vectors.len());
Ok(FixedSizeListArray::try_new_from_values(
residual_arr,
dimension as i32,
Expand Down

0 comments on commit a6101e5

Please sign in to comment.