Skip to content

Latest commit

 

History

History
 
 

bpool

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

README.md

bpool GoDoc

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

Install

go get github.com/oxtoacart/bpool

Documentation

See godoc.org or use godoc github.com/oxtoacart/bpool

Example

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
}