mem

package
v0.0.0-...-87a979f Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2016 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Get

func Get(l int) []byte

自动选择合适的池

func Put

func Put(buf []byte) error

回填池 可以放心尺寸的问题,切片尺寸有问题会被放弃

Types

type Pool

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

这个封装的目的是防止返回的切片尺寸不对

var PoolByte1024 *Pool
var PoolByte2048 *Pool
var PoolByte4096 *Pool
var PoolByteforward *Pool

全局内存池

func NewPool

func NewPool(size int) *Pool

新建一个池

func (*Pool) Get

func (p *Pool) Get() []byte

func (*Pool) Put

func (p *Pool) Put(buf []byte)

回填池 可以放心尺寸的问题,切片尺寸有问题会被放弃

Jump to

Keyboard shortcuts

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