From 66ec463a4df39aff4bd8ff888309877d3dce062e Mon Sep 17 00:00:00 2001 From: Mostyn Bramley-Moore Date: Thu, 7 Jan 2021 23:26:33 +0100 Subject: [PATCH] upgrade github.com/klauspost/compress to v1.11.6 This version has a fix that makes decoder.Reset(nil) release resources: https://github.com/klauspost/compress/commit/fa5ea64d60c615a664931521778e111b45a43dbc --- decoderpool.go | 8 ++++---- go.mod | 2 +- go.sum | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/decoderpool.go b/decoderpool.go index 1204788..355f012 100644 --- a/decoderpool.go +++ b/decoderpool.go @@ -47,10 +47,10 @@ type DecoderWrapper struct { // be reused), but instead resets it and places this *DecoderWrapper back in // the pool. func (w *DecoderWrapper) Close() { - // FIXME: https://github.com/klauspost/compress/issues/296 - w.Decoder.Reset(nil) - - w.pool.Put(w) + err := w.Decoder.Reset(nil) + if err != nil { + w.pool.Put(w) + } } // IOReadCloser returns an io.ReadCloser that will return this *DecoderWrapper diff --git a/go.mod b/go.mod index 6fcf83c..bd22033 100644 --- a/go.mod +++ b/go.mod @@ -2,4 +2,4 @@ module github.com/mostynb/zstdpool-syncpool go 1.15 -require github.com/klauspost/compress v1.11.4 +require github.com/klauspost/compress v1.11.6 diff --git a/go.sum b/go.sum index 61a34c5..a9fe24f 100644 --- a/go.sum +++ b/go.sum @@ -1,2 +1,2 @@ -github.com/klauspost/compress v1.11.4 h1:kz40R/YWls3iqT9zX9AHN3WoVsrAWVyui5sxuLqiXqU= -github.com/klauspost/compress v1.11.4/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs= +github.com/klauspost/compress v1.11.6 h1:EgWPCW6O3n1D5n99Zq3xXBt9uCwRGvpwGOusOLNBRSQ= +github.com/klauspost/compress v1.11.6/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs=