Documentation
¶
Overview ¶
Package bufferpool provides a simple buffer pool.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BufferPool ¶
type BufferPool struct {
// contains filtered or unexported fields
}
BufferPool provides a buffer pool that may help reduce memory allocations and GC overhead. BufferPool uses multiple underlying pools of different sizes and a fallback pool.
func New ¶
func New(sizeClasses ...int) *BufferPool
New creates a BufferPool with the underlying pools of given sizes and a fallback pool. If sizeClasses are not provided, only the fallback pool will be created.
func (*BufferPool) Get ¶
func (p *BufferPool) Get(size int) *[]byte
Get returns a buffer with specified length from the pool.
Click to show internal directories.
Click to hide internal directories.