FILE / ScuroNeko/mtg

mtglib/internal/relay/pools.go

Исходный файл и его история в репозитории.
FILE db2e6031a3aeec840ef2c2b51ae2e3288355f416
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)
}