bp

package module
v0.0.0-...-3f7b4c2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 28, 2014 License: MIT Imports: 2 Imported by: 0

README

bufferpool

A simple go package for recycling memory buffers of type byte.Buffer with a pre-allocated underlying slice

GoDoc

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BP

type BP struct {
	Get   <-chan *bytes.Buffer // Get a buffer from the pool
	Give  chan<- *bytes.Buffer // Give a buffer to be stored in the pool
	Makes int                  // total buffers allocated
	// contains filtered or unexported fields
}

BP includes Get and Give directional channels for retrieving and returning buffers

func New

func New(bufsz int) *BP

New initalizes a new buffer pool

func (*BP) Shutdown

func (bp *BP) Shutdown()

Shutdown terminates the pool, closing the Get and Give channels and freeing pool buffers to be garbage collected

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL