bufpool

package
v3.4.1 Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2025 License: AGPL-3.0 Imports: 3 Imported by: 0

Documentation

Overview

Package bufpool offers a pool of *bytes.Buffer objects that are placed into exponentially sized buckets.

Bucketing prevents the memory cost of a pool from permanently increasing when a large buffer is placed into the pool.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Get

func Get(size int) *bytes.Buffer

Get returns a buffer from the pool for the given size. Returned buffers are reset and ready for writes.

The capacity of the returned buffer is guaranteed to be at least size.

func Put

func Put(buf *bytes.Buffer)

Put returns a buffer to the pool. The buffer is placed into an appropriate bucket based on its current capacity.

Types

This section is empty.

Jump to

Keyboard shortcuts

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