mempool

package
v0.0.0-...-b8c083d Latest Latest
Warning

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

Go to latest
Published: Aug 4, 2024 License: MIT Imports: 4 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

func AppendString

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

func Free

func Free(buf []byte)

func Malloc

func Malloc(size int) []byte

func Realloc

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

Types

type AlignedAllocator

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

AlignedAllocator .

func (*AlignedAllocator) Append

func (amp *AlignedAllocator) Append(buf []byte, more ...byte) []byte

Append .

func (*AlignedAllocator) AppendString

func (amp *AlignedAllocator) AppendString(buf []byte, s string) []byte

AppendString .

func (*AlignedAllocator) Free

func (amp *AlignedAllocator) Free(buf []byte)

Free .

func (*AlignedAllocator) Malloc

func (amp *AlignedAllocator) Malloc(size int) []byte

Malloc .

func (*AlignedAllocator) Realloc

func (amp *AlignedAllocator) Realloc(buf []byte, size int) []byte

Realloc .

func (AlignedAllocator) SetDebug

func (d AlignedAllocator) SetDebug(dbg bool)

func (AlignedAllocator) String

func (d AlignedAllocator) String() string

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 .

func NewAligned

func NewAligned() Allocator

NewAligned .

func NewSTD

func NewSTD() Allocator

type DebugAllocator

type DebugAllocator interface {
	Allocator
	String() string
	SetDebug(bool)
}

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 .

func (MemPool) SetDebug

func (d MemPool) SetDebug(dbg bool)

func (MemPool) String

func (d MemPool) String() string

Jump to

Keyboard shortcuts

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