mempool

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Jun 24, 2023 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultMemPool = New(1024, 1024*1024*1024)

DefaultMemPool .

Functions

func Append

func Append(buf []byte, more ...byte) []byte

Append exports default package method.

func AppendString

func AppendString(buf []byte, more string) []byte

AppendString exports default package method.

func Free

func Free(buf []byte)

Free exports default package method.

func Init

func Init(bufSize, freeSize int)

func Malloc

func Malloc(size int) []byte

Malloc exports default package method.

func Realloc

func Realloc(buf []byte, size int) []byte

Realloc exports default package method.

Types

type Allocator

type Allocator interface {
	Malloc(size int) []byte
	Realloc(buf []byte, size int) []byte
	Append(buf []byte, more ...byte) []byte
	AppendString(buf []byte, more string) []byte
	Free(buf []byte)
}

func New

func New(bufSize, freeSize int) Allocator

New .

type MemPool

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

MemPool .

func (*MemPool) Append

func (mp *MemPool) Append(buf []byte, more ...byte) []byte

Append .

func (*MemPool) AppendString

func (mp *MemPool) AppendString(buf []byte, more string) []byte

AppendString .

func (*MemPool) Free

func (mp *MemPool) Free(buf []byte)

Free .

func (*MemPool) Malloc

func (mp *MemPool) Malloc(size int) []byte

Malloc .

func (*MemPool) Realloc

func (mp *MemPool) Realloc(buf []byte, size int) []byte

Realloc .

type NativeAllocator

type NativeAllocator struct{}

NativeAllocator definition.

func (*NativeAllocator) Free

func (a *NativeAllocator) Free(buf []byte)

Free .

func (*NativeAllocator) Malloc

func (a *NativeAllocator) Malloc(size int) []byte

Malloc .

func (*NativeAllocator) Realloc

func (a *NativeAllocator) Realloc(buf []byte, size int) []byte

Realloc .

Jump to

Keyboard shortcuts

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