From 3564a506ed73df67339cf6fd17ab18657634efd4 Mon Sep 17 00:00:00 2001 From: "vitess-bot[bot]" <108069721+vitess-bot[bot]@users.noreply.github.com> Date: Tue, 28 Nov 2023 10:49:11 -0600 Subject: [PATCH] [release-17.0] vindexes: fix pooled collator buffer memory leak (#14621) (#14623) Co-authored-by: vitess-bot[bot] <108069721+vitess-bot[bot]@users.noreply.github.com> --- go/vt/vtgate/vindexes/unicode.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/go/vt/vtgate/vindexes/unicode.go b/go/vt/vtgate/vindexes/unicode.go index bbf0be16c1d..6711f77c7d9 100644 --- a/go/vt/vtgate/vindexes/unicode.go +++ b/go/vt/vtgate/vindexes/unicode.go @@ -33,7 +33,10 @@ import ( func unicodeHash(hashFunc func([]byte) []byte, key sqltypes.Value) ([]byte, error) { collator := collatorPool.Get().(*pooledCollator) - defer collatorPool.Put(collator) + defer func() { + collator.buf.Reset() + collatorPool.Put(collator) + }() keyBytes, err := key.ToBytes() if err != nil {