1
0
mirror of https://github.com/fumiama/terasu-cloudflared.git synced 2026-06-07 01:50:23 +08:00
Files
terasu-cloudflared/vendor/github.com/kshvakov/clickhouse/lib/leakypool/leaky_pool.go
2019-11-12 20:34:39 +00:00

24 lines
308 B
Go

package leakypool
var pool chan []byte
func InitBytePool(size int) {
pool = make(chan []byte, size)
}
func GetBytes(size, capacity int) (b []byte) {
select {
case b = <-pool:
default:
b = make([]byte, size, capacity)
}
return
}
func PutBytes(b []byte) {
select {
case pool <- b:
default:
}
}