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 ¶
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 GetReader ¶ added in v3.6.0
GetReader returns a pooled bufio.Reader. The returned reader is reset to read from r.
func GetUnsized ¶ added in v3.6.0
GetUnsized returns a buffer from the unsized pool. Returned buffers are reset and ready for writes.
Buffers retrieved by GetUnsized should be returned to the pool with PutUnsized.
func Put ¶
Put returns a buffer to the pool. The buffer is placed into an appropriate bucket based on its current capacity.
func PutReader ¶ added in v3.6.0
PutReader puts the reader back into the pool. It is not safe to use the reader after calling PutReader.
func PutUnsized ¶ added in v3.6.0
PutUnsized returns a buffer to the unsized pool. PutUnsized should only be used for buffers retrieved by GetUnsized.
Types ¶
This section is empty.