package iobufpool

import "github.com/jackc/pgx/v5/internal/iobufpool"

Package iobufpool implements a global segregated-fit pool of buffers for IO.

It uses *[]byte instead of []byte to avoid the sync.Pool allocation with Put. Unfortunately, using a pointer to avoid an allocation is purposely not documented. https://github.com/golang/go/issues/16323

Index

Functions

func Get

func Get(size int) *[]byte

Get gets a []byte of len size with cap <= size*2.

func Put

func Put(buf *[]byte)

Put returns buf to the pool.

Source Files

iobufpool.go

Version
v5.7.2 (latest)
Published
Dec 21, 2024
Platform
linux/amd64
Imports
1 packages
Last checked
5 days ago

Tools for package owners.