package nsqd
import (
"bytes"
"sync"
)
var bp sync.Pool
func init() {
bp.New = func() interface{} {
return &bytes.Buffer{}
}
}
func bufferPoolGet() *bytes.Buffer {
return bp.Get().(*bytes.Buffer)
}
func bufferPoolPut(b *bytes.Buffer) {
bp.Put(b)
}
时间: 2024-10-21 10:23:56