summaryrefslogtreecommitdiff
path: root/internal/io/pool/bytesbuffer.go
blob: 0a159f552a0d6a867e5c6938ff517004afe183b5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
package pool

import (
	"bytes"
	"sync"
)

var BytesBuffer = sync.Pool{
	New: func() interface{} {
		b := bytes.Buffer{}
		b.Grow(128)
		return &b
	},
}

func RecycleBytesBuffer(b *bytes.Buffer) {
	b.Reset()
	BytesBuffer.Put(b)
}