clash/common/pool/pool.go

17 lines
368 B
Go
Raw Normal View History

2019-04-23 23:29:36 +08:00
package pool
const (
// io.Copy default buffer size is 32 KiB
// but the maximum packet size of vmess/shadowsocks is about 16 KiB
// so define a buffer of 20 KiB to reduce the memory of each TCP relay
2020-04-25 00:30:40 +08:00
RelayBufferSize = 20 * 1024
2019-04-23 23:29:36 +08:00
)
2020-04-25 00:30:40 +08:00
func Get(size int) []byte {
return defaultAllocator.Get(size)
}
func Put(buf []byte) error {
return defaultAllocator.Put(buf)
}