You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
z := gzip.NewWriter(nil)
for {
buf := new(bytes.Buffer)
z.Reset(buf)
msg := getMessage()
z.Write(msg)
z.Close()
processMessage(msg)
}
When closing z, Close() calls compressCurrent(), which gets two buffers from z.dstPool. The second one, in gzip.go:272, is never put back to z.dstPool, since z.init (called from z.Reset) sets z.currentBuffer = nil.
It means that dstPool is not fully utilized, and there are many redundant alllcations
The text was updated successfully, but these errors were encountered:
I use a writer in a loop, which looks like this:
When closing z,
Close()
callscompressCurrent()
, which gets two buffers from z.dstPool. The second one, in gzip.go:272, is never put back to z.dstPool, since z.init (called from z.Reset) setsz.currentBuffer = nil
.It means that dstPool is not fully utilized, and there are many redundant alllcations
The text was updated successfully, but these errors were encountered: