bufpool

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Jun 5, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package bufpool implements size-classed, sharded byte-slice pools.

Buffers are bucketed by capacity, so a small Get does not receive a previously-released multi-MiB slice. The pool stores *[]byte to avoid the interface-conversion allocation that putting a []byte directly into sync.Pool incurs.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Get

func Get(hint int) *[]byte

Get returns a *[]byte with cap >= hint and length 0. Anything larger than classHuge is allocated outside the pool.

func Put

func Put(b *[]byte)

Put returns b to the pool. Buffers grown past classHuge are dropped so the GC can reclaim them.

Types

This section is empty.

Jump to

Keyboard shortcuts

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