pool

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2022 License: MIT Imports: 6 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// GetByte retrieves a byte slice but uses the global pool
	GetByte = builtinPool.Get
	// PutByte returns a byte slice but uses the global pool
	PutByte = builtinPool.Put
)

Functions

This section is empty.

Types

type BytePool

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

Pool consists of 32 sync.Pool, representing byte slices of length from 0 to 32 in powers of 2.

func (*BytePool) Get

func (p *BytePool) Get(size int) (buf []byte)

Get retrieves a byte slice of the length requested by the caller from pool or allocates a new one.

func (*BytePool) Put

func (p *BytePool) Put(buf []byte)

Put returns the byte slice to the pool.

Jump to

Keyboard shortcuts

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