Simple []byte buffer pool for go backend by sync.Pool.
package main
import "github.com/IrineSistiana/go-bytes-pool"
func main() {
// a pool for []bytes whose length are smaller than 65535 ((1<<16) -1))
p := NewPool(16)
b := p.Get(1024)
p.Release(b)
}
Get returns a *[]byte from pool with most appropriate cap.
It returns a *[]byte with cap of (2^n)-1.
If size > pool's maxSize, Get simply calls make([]byte, size).
Release releases b to the pool.
If cap(b) > pool's maxSize, Release is noop.
b should come from Get(). Release will panic if
cap(b) is not suitable for the pool.