From 7c2104e2e127c557d294eb044519438cd6ba968b Mon Sep 17 00:00:00 2001 From: Alex Sharov Date: Mon, 17 Jan 2022 17:05:37 +0700 Subject: [PATCH] fix to no prealloc (because max size unknown) --- compress/compress.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/compress/compress.go b/compress/compress.go index 9f15cb29d..72a4cbc2b 100644 --- a/compress/compress.go +++ b/compress/compress.go @@ -118,11 +118,11 @@ func (c *Compressor2) Compress() error { go processSuperstring(superstrings, collector, c.minPatternScore, wg) } i := 0 - c.superstring = make([]byte, 0, superstringLimit) + c.superstring = nil if err := c.datFile.ForEach(func(word []byte) error { if len(c.superstring)+2*len(word)+2 > superstringLimit { superstrings <- c.superstring - c.superstring = make([]byte, 0, superstringLimit) + c.superstring = nil } for _, a := range word { c.superstring = append(c.superstring, 1, a)