diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2021-01-11 16:57:50 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-01-11 16:57:50 -0500 |
commit | 20217f578941a207fadac92535f4b56bca99e424 (patch) | |
tree | 15b7d850b960d83ea1fb57922300363ff2fda7da /vendor/github.com/klauspost/compress/zstd/seqdec.go | |
parent | d2503ae99b773db7b9dbdf3abf3be0160ac78399 (diff) | |
parent | 63ecd1215ac815dc38c41f70d50e0de34d3854b9 (diff) | |
download | podman-20217f578941a207fadac92535f4b56bca99e424.tar.gz podman-20217f578941a207fadac92535f4b56bca99e424.tar.bz2 podman-20217f578941a207fadac92535f4b56bca99e424.zip |
Merge pull request #8932 from containers/dependabot/go_modules/github.com/containers/storage-1.24.5
Bump github.com/containers/storage from 1.24.4 to 1.24.5
Diffstat (limited to 'vendor/github.com/klauspost/compress/zstd/seqdec.go')
-rw-r--r-- | vendor/github.com/klauspost/compress/zstd/seqdec.go | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/vendor/github.com/klauspost/compress/zstd/seqdec.go b/vendor/github.com/klauspost/compress/zstd/seqdec.go index b5c8ef133..1dd39e63b 100644 --- a/vendor/github.com/klauspost/compress/zstd/seqdec.go +++ b/vendor/github.com/klauspost/compress/zstd/seqdec.go @@ -181,11 +181,18 @@ func (s *sequenceDecs) decode(seqs int, br *bitReader, hist []byte) error { return fmt.Errorf("output (%d) bigger than max block size", size) } if size > cap(s.out) { - // Not enough size, will be extremely rarely triggered, + // Not enough size, which can happen under high volume block streaming conditions // but could be if destination slice is too small for sync operations. - // We add maxBlockSize to the capacity. - s.out = append(s.out, make([]byte, maxBlockSize)...) - s.out = s.out[:len(s.out)-maxBlockSize] + // over-allocating here can create a large amount of GC pressure so we try to keep + // it as contained as possible + used := len(s.out) - startSize + addBytes := 256 + ll + ml + used>>2 + // Clamp to max block size. + if used+addBytes > maxBlockSize { + addBytes = maxBlockSize - used + } + s.out = append(s.out, make([]byte, addBytes)...) + s.out = s.out[:len(s.out)-addBytes] } if ml > maxMatchLen { return fmt.Errorf("match len (%d) bigger than max allowed length", ml) |