|
|
před 11 roky | |
|---|---|---|
| .. | ||
| README.md | před 11 roky | |
| bufferpool.go | před 11 roky | |

Package bpool implements leaky pools of byte arrays and Buffers as bounded channels. It is based on the leaky buffer example from the Effective Go documentation: http://golang.org/doc/effective_go.html#leaky_buffer
go get github.com/oxtoacart/bpool
See godoc.org or use godoc github.com/oxtoacart/bpool
var bufpool *bpol.BufferPool
func main() {
bufpool = bpool.NewBufferPool(48)
}
func someFunction() error {
// Get a buffer from the pool
buf := bufpool.Get()
...
...
...
// Return the buffer to the pool
bufpool.Put(buf)
return nil
}