From 4598e71124c4774cc75bcacde4f8b2e380f20394 Mon Sep 17 00:00:00 2001 From: Artur Melanchyk Date: Mon, 23 Dec 2024 21:43:42 +0100 Subject: [PATCH] specify slice cap Signed-off-by: Artur Melanchyk --- internal/eval/countminsketch.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/eval/countminsketch.go b/internal/eval/countminsketch.go index c18b8d854..375c517d2 100644 --- a/internal/eval/countminsketch.go +++ b/internal/eval/countminsketch.go @@ -308,7 +308,7 @@ func DeserializeCMS(buffer *bytes.Reader) (*CountMinSketch, error) { matrix := make([][]uint64, depth) flatMatrix := make([]uint64, depth*width) // single memory allocation for i := 0; i < int(depth); i++ { - matrix[i] = flatMatrix[i*int(width) : (i+1)*int(width)] + matrix[i] = flatMatrix[i*int(width) : (i+1)*int(width) : (i+1)*int(width)] for j := 0; j < int(width); j++ { if err := binary.Read(buffer, binary.BigEndian, &matrix[i][j]); err != nil { return nil, err