bytepool

package
v0.0.0-...-384af84 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2023 License: BSD-2-Clause Imports: 1 Imported by: 0

Documentation

Overview

Package bytepool implements an optimization for byte slice allocations by caching those slices for later reuse.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BytePool

type BytePool struct {
	sync.Pool
}

BytePool is a cached pool of reusable byte slices.

func New

func New(length int) *BytePool

New allocates a new BytePool with slices of equal length and capacity.

func (*BytePool) Get

func (bp *BytePool) Get() *[]byte

Get returns a byte slice from the pool.

func (*BytePool) Put

func (bp *BytePool) Put(b *[]byte)

Put returns a byte slice to the pool.

Jump to

Keyboard shortcuts

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