examples

package
v0.0.0-...-cefda66 Latest Latest
Warning

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

Go to latest
Published: Dec 30, 2016 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type T

type T struct {
}

type TFreeList

type TFreeList struct {
	// contains filtered or unexported fields
}

func NewTFreeList

func NewTFreeList() *TFreeList

NewTFreeList instantiates a freelist of T TFreeList will be used to temporary store T objects for further usage and therefore save the memory allocation and garbage collection overhead.

A TFreeList references at most 42 T objects in a chan. This prevents garbage collection for them

func (TFreeList) Get

func (p TFreeList) Get() *T

func (TFreeList) Put

func (p TFreeList) Put(t *T)

type TPool

type TPool struct {
	sync.Pool
}

TPool is a typed pool of T It temporarily stores instantiations of T for later use.

func NewTPool

func NewTPool() *TPool

NewTPool instantiates a typed pool of T TPool will be used to temporary store T objects for further usage and therefore save the memory allocation and garbage collection overhead.

Any object can be freed at any time. Use a freelist if don't want any of those objects to be freed. See sync.Pool for a better understanding

func (TPool) Get

func (p TPool) Get() *T

Get instantiates a T if none is available in pool, otherwise an available one will be returned. see sync.Pool.Get

func (TPool) Put

func (p TPool) Put(t *T)

Store a T into pool see sync.Pool.Put

Jump to

Keyboard shortcuts

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