buffer

package
v1.1.5 Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2024 License: GPL-3.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ReplaceBufferPool

func ReplaceBufferPool(size int)

Types

type BytePool

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

BytePool implements a leaky pool of []byte in the form of a bounded channel

var (
	BufferPool    *BytePool
	UDPBufferPool *BytePool
)

全局pool

func NewBytePool

func NewBytePool(maxSize int, size int) (bp *BytePool)

NewBytePool creates a new BytePool bounded to the given maxSize, with new byte arrays sized based on width.

func (*BytePool) Get

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

Get gets a []byte from the BytePool, or creates a new one if none are available in the pool.

func (*BytePool) Put

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

Put returns the given Buffer to the BytePool.

Jump to

Keyboard shortcuts

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