We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 1025055 + 2582956 commit af72dbdCopy full SHA for af72dbd
internal/buffer/buffer.go
@@ -55,6 +55,17 @@ func GetBuffer() *Buffer {
55
56
// PutBuffer returns a buffer to the free list.
57
func PutBuffer(b *Buffer) {
58
+ if b.Len() >= 256 {
59
+ // Let big buffers die a natural death, without relying on
60
+ // sync.Pool behavior. The documentation implies that items may
61
+ // get deallocated while stored there ("If the Pool holds the
62
+ // only reference when this [= be removed automatically]
63
+ // happens, the item might be deallocated."), but
64
+ // https://github.com/golang/go/issues/23199 leans more towards
65
+ // having such a size limit.
66
+ return
67
+ }
68
+
69
buffers.Put(b)
70
}
71
0 commit comments