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.
Click to show internal directories.
Click to hide internal directories.