MCPcopy
hub / github.com/grpc/grpc-go / sizedBufferPool

Struct sizedBufferPool

internal/mem/buffer_pool.go:220–224  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

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.
220type sizedBufferPool struct {
221 pool sync.Pool
222 defaultSize int
223 shouldZero bool
224}
225
226func (p *sizedBufferPool) Get(size int) *[]byte {
227 buf, ok := p.pool.Get().(*[]byte)

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected