mempool

package
v0.0.0-...-4158b14 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2026 License: MIT Imports: 7 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(pbuf *[]byte, more ...byte) *[]byte

func AppendString

func AppendString(pbuf *[]byte, more string) *[]byte

func Free

func Free(pbuf *[]byte)

func Malloc

func Malloc(size int) *[]byte

func Realloc

func Realloc(pbuf *[]byte, size int) *[]byte

Types

type AlignedAllocator

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

AlignedAllocator .

func (*AlignedAllocator) Append

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

Append .

func (*AlignedAllocator) AppendString

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

AppendString .

func (*AlignedAllocator) Free

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

Free .

func (*AlignedAllocator) Malloc

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

Malloc .

func (*AlignedAllocator) Realloc

func (amp *AlignedAllocator) Realloc(pbuf *[]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 // deprecated.
	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(pbuf *[]byte, more ...byte) *[]byte

Append .

func (*MemPool) AppendString

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

AppendString .

func (*MemPool) Free

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

Free .

func (*MemPool) Malloc

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

Malloc .

func (*MemPool) Realloc

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

Realloc .

func (MemPool) SetDebug

func (d MemPool) SetDebug(dbg bool)

func (MemPool) String

func (d MemPool) String() string

type TraceDebugger

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

func NewTraceDebuger

func NewTraceDebuger(allocator Allocator) *TraceDebugger

func (*TraceDebugger) Append

func (td *TraceDebugger) Append(pbuf *[]byte, more ...byte) *[]byte

Append .

func (*TraceDebugger) AppendString

func (td *TraceDebugger) AppendString(pbuf *[]byte, more string) *[]byte

AppendString .

func (*TraceDebugger) Free

func (td *TraceDebugger) Free(pbuf *[]byte)

Free .

func (*TraceDebugger) Malloc

func (td *TraceDebugger) Malloc(size int) *[]byte

Malloc .

func (*TraceDebugger) Realloc

func (td *TraceDebugger) Realloc(pbuf *[]byte, size int) *[]byte

deprecated.

Jump to

Keyboard shortcuts

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