FILE / ScuroNeko/mtg

mtglib/internal/relay/pools.go

Исходный файл и его история в репозитории.
FILE 1a81efcb6e52a2e11c328f550becba0d58f0eac6
Files
mtg/mtglib/internal/relay/pools.go
T

19 lines
242 B
Go

package relay
import "sync"
var bufPool = sync.Pool{
New: func() any {
b := make([]byte, bufPoolSize)
return &b
},
}
func acquireBuffer() *[]byte {
return bufPool.Get().(*[]byte)
}
func releaseBuffer(p *[]byte) {
bufPool.Put(p)
}