Discover Packages
github.com/danjacques/gopushpixels
support
bufferpool
package
Version:
v0.0.0-...-119448c
Opens a new window with list of versions in this module.
Published: Apr 20, 2018
License: MIT
Opens a new window with license information.
Imports: 2
Opens a new window with list of imports.
Imported by: 1
Opens a new window with list of known importers.
Documentation
Documentation
¶
Buffer contains a byte buffer that can be released into a Pool for reuse.
Buffer is reference counted, and can be retained and released appropriately.
Failure to release Buffer will not cause a memory leak, but will prevent the
reuse of the Buffer.
Bytes returns this buffer's byte slice.
Len returns the number of bytes in the buffer.
Release returns the buffer to its buffer pool.
Release is safe for concurrent use.
A Buffer must only be released once.
Retain increases the Buffer's reference count. It should be accompanied by
a Release call to reuse the buffer when it's finished.
Truncate artificially caps the number of bytes returned by Bytes.
type Pool struct {
Size int
}
Pool maintains a pool of buffers. It offers a new buffer when one is
unavailable.
Get returns a buffer, allocating one if one is not available. The returned
buffer is Reset and returned with a reference count of 1.
The caller should return the buffer to the pool by calling its Release method
when done with it.
Source Files
¶
Click to show internal directories.
Click to hide internal directories.