-
Notifications
You must be signed in to change notification settings - Fork 84
Open
Description
I use a writer in a loop, which looks like this:
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
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels