mem

package
v1.20.0 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2025 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package mem uses multiple sync pools of byte slices to provide allocation-free buffers of various sizes.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Alloc

func Alloc(byteSize int) []byte

Alloc returns a memory block of at least the indicated byte size. The length of the buffer is 0.

Example:

block := mem.Alloc()
defer mem.Free(block)

func Copy

func Copy(original []byte) (clone []byte)

Copy returns a new memory block with the same contents of the original.

func Free

func Free(block []byte)

Free releases the memory block.

Types

This section is empty.

Jump to

Keyboard shortcuts

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