1 Star 0 Fork 0

nggs / micro

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
allocator.go 697 Bytes
一键复制 编辑 原始数据 按行查看 历史
李文建 提交于 2020-04-05 00:11 . 整合其他模块代码
package protocol
import "github.com/funny/slab"
type IAllocator interface {
slab.Pool
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
type NonAllocator struct {
}
func (NonAllocator) Alloc(size int) []byte {
return make([]byte, size)
}
func (NonAllocator) Free(buffer []byte) {
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
func NewSlabAllocator() IAllocator {
return slab.NewAtomPool(64, 64*1024, 2, 1024*1024)
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
Go
1
https://gitee.com/nggs/micro.git
git@gitee.com:nggs/micro.git
nggs
micro
micro
bac99dff65eb

搜索帮助

53164aa7 5694891 3bd8fe86 5694891