buffers

package
v2.1.2 Latest Latest
Warning

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

Go to latest
Published: May 25, 2026 License: GPL-3.0 Imports: 2 Imported by: 0

Documentation

Overview

Package buffers provides efficient memory management utilities for buffer pooling.

Index

Constants

This section is empty.

Variables

View Source
var (
	// DefaultBufferPool provides buffers for general file operations (32KB).
	DefaultBufferPool = sync.Pool{
		New: func() any {
			return make([]byte, constants.DefaultBufferSize)
		},
	}

	// SmallBufferPool provides smaller buffers for line-based operations (1KB).
	SmallBufferPool = sync.Pool{
		New: func() any {
			return make([]byte, constants.SmallBufferSize)
		},
	}
)

Buffer pools for different use cases to reduce garbage collection pressure.

Functions

func GetSmallBuffer

func GetSmallBuffer() []byte

GetSmallBuffer returns a buffer from the small buffer pool.

func PutSmallBuffer

func PutSmallBuffer(buf []byte)

PutSmallBuffer returns a buffer to the small buffer pool.

Types

This section is empty.

Jump to

Keyboard shortcuts

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