type BytesPool struct {
// contains filtered or unexported fields
}
BytesPool maintains large bytes pools, used for reducing memory allocation.
It has a slice of pools which handle different size of bytes.
Can be safely used concurrently.
Alloc allocates a bytes which has the size of power of two.
The caller should keep the origin bytes and use the returned data.
When finished using, the origin bytes should be freed to the pool.
The allocated data may not have zero value.
Free frees the data which should be the original bytes return by Alloc.
It returns the bucket index of the data. returns -1 means the data is not returned to the pool.