pool

package
v0.1.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 12, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Disable

func Disable()

Disable turns off sync.Pool optimizations

func DiscardOversized

func DiscardOversized() bool

DiscardOversized returns whether oversized buffers should be discarded

func Enable

func Enable()

Enable turns on sync.Pool optimizations

func Enabled

func Enabled() bool

Enabled returns whether pool optimizations are currently enabled

func Get

func Get(hint int) *bytes.Buffer

Get retrieves a buffer from the pool, sized according to the hint. If pooling is disabled, it returns a new buffer.

func MaxPoolSize

func MaxPoolSize() int

MaxPoolSize returns the maximum buffer size to keep in pools in bytes

func Put

func Put(buf *bytes.Buffer)

Put returns a buffer to the pool. If pooling is disabled or the buffer is too large, it is discarded.

func SetMaxPoolSize

func SetMaxPoolSize(size int, discard bool)

SetMaxPoolSize configures the maximum buffer size to keep in pools. Buffers larger than this will be discarded if discard is true, otherwise they will be resized back to maxSize before being pooled.

func SetThreshold added in v0.1.1

func SetThreshold(size int)

SetThreshold sets the size threshold between small and large pools in bytes

func Threshold added in v0.1.1

func Threshold() int

Threshold returns the size threshold between small and large pools in bytes

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL