sizedBufferPool is a BufferPool implementation that is optimized for specific buffer sizes. For example, HTTP/2 frames within gRPC have a default max size of 16kb and a sizedBufferPool can be configured to only return buffers with a capacity of 16kb. Note that however it does not support returning l
| 218 | // is intended to be embedded in a TieredBufferPool such that Get is only |
| 219 | // invoked when the required size is smaller than or equal to defaultSize. |
| 220 | type sizedBufferPool struct { |
| 221 | pool sync.Pool |
| 222 | defaultSize int |
| 223 | shouldZero bool |
| 224 | } |
| 225 | |
| 226 | func (p *sizedBufferPool) Get(size int) *[]byte { |
| 227 | buf, ok := p.pool.Get().(*[]byte) |
nothing calls this directly
no outgoing calls
no test coverage detected