Skip to content

Commit

Permalink
fix: return buffers to the pool after use
Browse files Browse the repository at this point in the history
  • Loading branch information
Ja7ad committed Dec 25, 2024
1 parent 95039b1 commit dbc843a
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions encoding.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@ func (g *gzipEncoder) Encode(rc io.Reader) (*bytes.Buffer, error) {
}()

buf := g.bufferPool.Get().(*bytes.Buffer)
defer g.bufferPool.Put(buf)

buf.Reset()
w.writer.Reset(buf)

Expand Down

0 comments on commit dbc843a

Please sign in to comment.