From 86b119ac7ba206d294eb257f99c308fe8452bd58 Mon Sep 17 00:00:00 2001 From: Cyril Tovena Date: Thu, 6 Jun 2024 09:55:46 +0200 Subject: [PATCH] fix: Add copyString function to symbolizer to avoid retaining memory (#13146) --- pkg/chunkenc/symbols.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pkg/chunkenc/symbols.go b/pkg/chunkenc/symbols.go index bed4035400c7..a3e2a5b011e2 100644 --- a/pkg/chunkenc/symbols.go +++ b/pkg/chunkenc/symbols.go @@ -6,6 +6,7 @@ import ( "fmt" "hash" "io" + "strings" "sync" "github.com/pkg/errors" @@ -78,6 +79,7 @@ func (s *symbolizer) add(lbl string) uint32 { idx, ok = s.symbolsMap[lbl] if !ok { + lbl = strings.Clone(lbl) idx = uint32(len(s.labels)) s.symbolsMap[lbl] = idx s.labels = append(s.labels, lbl)