internal

package
v0.0.0-...-48a15a0 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2022 License: 0BSD Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var BytesPool4k = NewBytesPool(4096, 128)

BytesPool4k is a BytesPool with array size 4096, used as message forwarding buffer.

View Source
var BytesPool64k = NewBytesPool(65536, 16)

BytesPool64k is a BytesPool with array size 65536, primarily used as large header and UDP receive buffer.

Functions

This section is empty.

Types

type BytesPool

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

BytesPool is a fixed size byte array pool byte array is fized size, but byte array count is increased automatically.

func NewBytesPool

func NewBytesPool(bytesSize, poolSize int) *BytesPool

func (*BytesPool) Rent

func (p *BytesPool) Rent() []byte

Rent rent a byte array from pool, length is determined when creating pool.

func (*BytesPool) Return

func (p *BytesPool) Return(b []byte)

Return return a rented byte array to pool\ always return what exactly you rented.

Jump to

Keyboard shortcuts

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