FILE / ScuroNeko/mtg

mtglib/internal/relay/pools.go

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