Help us shape the future of Go! Take the 2026 Go Developer Survey

pool

package
v0.309.1 Latest Latest
Warning

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

Go to latest
Published: Jan 7, 2026 License: Apache-2.0 Imports: 3 Imported by: 27

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Pool

type Pool struct {
	// contains filtered or unexported fields
}

Pool is a bucketed pool for variably sized byte slices.

func New

func New(minSize, maxSize int, factor float64, makeFunc func(int) any) *Pool

New returns a new Pool with size buckets for minSize to maxSize increasing by the given factor.

func (*Pool) Get

func (p *Pool) Get(sz int) any

Get returns a new byte slices that fits the given size.

func (*Pool) Put

func (p *Pool) Put(s any)

Put adds a slice to the right bucket in the pool.

Jump to

Keyboard shortcuts

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