Documentation ¶
Index ¶
- Constants
- func CgoHandle(p Pool) cgo.Handle
- func GoBytes(data unsafe.Pointer, size int) []byte
- func HandlePoolFree(ctx unsafe.Pointer)
- func HandlePoolGet(ctx unsafe.Pointer, size int) unsafe.Pointer
- func HandlePoolPut(ctx unsafe.Pointer, data unsafe.Pointer, size int)
- func ReflectGoBytes(data unsafe.Pointer, sizeLen, sizeCap int) []byte
- func UnsafeGoBytes(data unsafe.Pointer, size int) []byte
- type CgoBytePool
- type DoneFunc
- type MemoryAligmentFunc
- type Pool
- type PoolStats
- type WithPoolFunc
Constants ¶
View Source
const ( AppName string = "cgobytepool" Version string = "1.0.3" )
Variables ¶
This section is empty.
Functions ¶
func HandlePoolFree ¶
func ReflectGoBytes ¶ added in v1.0.1
Types ¶
type CgoBytePool ¶
type CgoBytePool struct {
// contains filtered or unexported fields
}
func NewPool ¶
func NewPool(alignFunc MemoryAligmentFunc, poolFuncs ...WithPoolFunc) *CgoBytePool
func (*CgoBytePool) AllocBytes ¶
func (p *CgoBytePool) AllocBytes() int64
func (*CgoBytePool) Close ¶
func (p *CgoBytePool) Close()
func (*CgoBytePool) Stats ¶
func (p *CgoBytePool) Stats() PoolStats
func (*CgoBytePool) TotalAllocBytes ¶
func (p *CgoBytePool) TotalAllocBytes() int64
type MemoryAligmentFunc ¶
var (
DefaultMemoryAlignmentFunc MemoryAligmentFunc = func(n int) int {
return ((n + defaultMemoryAlignmentSize) >> 3) << 3
}
)
type WithPoolFunc ¶
type WithPoolFunc func(MemoryAligmentFunc) *cmallocPool
func WithPoolSize ¶
func WithPoolSize(poolSize, bufferSize int) WithPoolFunc
Click to show internal directories.
Click to hide internal directories.