memory

package module
v0.0.0-...-e121d80 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2021 License: MIT Imports: 7 Imported by: 0

README

NoGC Go - Extreme Go Performance

High performance manual memory management for Go and TinyGo.

Allocators

rpmalloc - Go

Rampant Pixel allocator. Extremely performant multi-threaded allocator that has the best overall performance of any major general purpose allocator. Destroys JEMalloc and TCMalloc in benchmarks at the cost of a little more memory use. Edges out mimalloc after 1 thread. The standard libc "malloc, free" are overridden with rpmalloc alternatives so any other C/C++/Rust code will automatically use rpmalloc.

TLSF - TinyGo

Two-Level Segregated Fit real-time allocator for TinyGo. Simple compact constant time allocator for predictable real-time performance. Intended for TinyGo WASM, but works on other TinyGo platforms as well as Go.

unsafe CGO

libfuzzerCall in Go runtime for amd64 and arm64 architectures is utilized to dramatically reduce CGO cost by 1,000%+. On a 2019 MacBook Pro the overhead is reduced from 53.9ns to 2.9ns or (3.9ns via linked runtime.libfuzzerCall).

Collections

Building on top of highly capable allocators and low CGO costs, external high-performance C/C++ libraries are integrated. The goal is to build a high-quality collection of extremely performant native collections that utilize the system allocator.

  • ART (Adaptive Radix Tree) (C)
  • BTree (C)
  • Robinhood HashMap (C++)
  • LockFree Queue (Go)

These collections incur Zero GC cost.

Net

Reactor

Documentation

Index

Constants

View Source
const PtrSize = 4 << (^uintptr(0) >> 63)

PtrSize is the size of a pointer in bytes - unsafe.Sizeof(uintptr(0)) but as an ideal constant. It is also the size of the machine's native word size (that is, 4 on 32-bit systems, 8 on 64-bit).

Variables

This section is empty.

Functions

func Cmp

func Cmp(a, b string) int

func Compare

func Compare(a, b unsafe.Pointer, n uintptr) int

func Copy

func Copy(dst, src unsafe.Pointer, n uintptr)

func Equals

func Equals(a, b unsafe.Pointer, size uintptr) bool

func Fastrand

func Fastrand() uint32

func FloorToPowerOfTwo

func FloorToPowerOfTwo(n int) int

FloorToPowerOfTwo returns the greatest power of two integer value less than or equal to n.

func Free

func Free(p Pointer)

Free calls Free on the system allocator

func Init

func Init()

func IsPowerOfTwo

func IsPowerOfTwo(n int) bool

IsPowerOfTwo reports whether given integer is a power of two.

func LogarithmicRange

func LogarithmicRange(min, max int, cb func(int))

LogarithmicRange iterates from ceiled to power of two min to max, calling cb on each iteration.

func Move

func Move(to, from unsafe.Pointer, n uintptr)

Move copies n bytes from "from" to "to".

Move ensures that any pointer in "from" is written to "to" with an indivisible write, so that racy reads cannot observe a half-written pointer. This is necessary to prevent the garbage collector from observing invalid pointers, and differs from Memmove in unmanaged languages. However, Memmove is only required to do this if "from" and "to" may contain pointers, which can only be the case if "from", "to", and "n" are all be word-aligned.

Implementations are in memmove_*.s.

func PrintDebugInfo

func PrintDebugInfo()

func Scope

func Scope(fn func(a AutoFree))

func SizeOf

func SizeOf(ptr Pointer) uintptr

func Zero

func Zero(ptr unsafe.Pointer, n uintptr)

Zero clears n bytes starting at ptr.

Usually you should use typedmemclr. memclrNoHeapPointers should be used only when the caller knows that *ptr contains no heap pointers because either:

*ptr is initialized memory and its type is pointer-free, or

*ptr is uninitialized memory (e.g., memory that's being reused for a new allocation) and hence contains only "junk".

memclrNoHeapPointers ensures that if ptr is pointer-aligned, and n is a multiple of the pointer size, then any pointer-aligned, pointer-sized portion is cleared atomically. Despite the function name, this is necessary because this function is the underlying implementation of typedmemclr and memclrHasPointers. See the doc of Memmove for more details.

The (CPU-specific) implementations of this function are in memclr_*.s.

Types

type AutoFree

type AutoFree uintptr

AutoFree is a singly linked list (Stack) of nodes which contain pointers that will all free when Free is called. uintptr is used to ensure the compiler doesn't confuse it for a Go GC managed pointer.

func NewAuto

func NewAuto(nodeSize uintptr) AutoFree

func (AutoFree) Alloc

func (af AutoFree) Alloc(size uintptr) Pointer

func (AutoFree) AllocCap

func (af AutoFree) AllocCap(size uintptr) FatPointer

func (AutoFree) Bytes

func (af AutoFree) Bytes(size uintptr) Bytes

func (*AutoFree) Close

func (af *AutoFree) Close() error

Close releases / frees every allocation

func (AutoFree) Count

func (af AutoFree) Count() uintptr

func (*AutoFree) Free

func (af *AutoFree) Free()

Free releases every allocation

func (*AutoFree) HasNext

func (af *AutoFree) HasNext() bool

func (AutoFree) Max

func (af AutoFree) Max() uintptr

func (*AutoFree) Next

func (af *AutoFree) Next() AutoFree

func (*AutoFree) Print

func (af *AutoFree) Print()

func (*AutoFree) Scope

func (af *AutoFree) Scope(fn func(AutoFree))

func (AutoFree) Size

func (af AutoFree) Size() uintptr

type Bytes

type Bytes struct {
	Pointer // Use for unchecked unsafe access
}

Bytes is a compact single dynamic allocation to be used as an unsafe replacement for string.

func AllocBytes

func AllocBytes(size uintptr) Bytes

func BytesRef

func BytesRef(ptr Pointer) *Bytes

func WrapBytes

func WrapBytes(b []byte) Bytes

func WrapString

func WrapString(s string) Bytes

func (*Bytes) Append

func (s *Bytes) Append(value Bytes)

func (*Bytes) AppendByte

func (s *Bytes) AppendByte(value byte)

func (*Bytes) AppendBytes

func (s *Bytes) AppendBytes(value []byte)

func (*Bytes) AppendFloat32

func (s *Bytes) AppendFloat32(value float32)

func (*Bytes) AppendFloat32BE

func (s *Bytes) AppendFloat32BE(value float32)

func (*Bytes) AppendFloat32LE

func (s *Bytes) AppendFloat32LE(value float32)

func (*Bytes) AppendFloat64

func (s *Bytes) AppendFloat64(value float64)

func (*Bytes) AppendFloat64BE

func (s *Bytes) AppendFloat64BE(value float64)

func (*Bytes) AppendFloat64LE

func (s *Bytes) AppendFloat64LE(value float64)

func (*Bytes) AppendInt

func (s *Bytes) AppendInt(value int)

func (*Bytes) AppendInt16

func (s *Bytes) AppendInt16(value int16)

func (*Bytes) AppendInt16BE

func (s *Bytes) AppendInt16BE(value int16)

func (*Bytes) AppendInt16LE

func (s *Bytes) AppendInt16LE(value int16)

func (*Bytes) AppendInt24

func (s *Bytes) AppendInt24(value int32)

func (*Bytes) AppendInt24BE

func (s *Bytes) AppendInt24BE(value int32)

func (*Bytes) AppendInt24LE

func (s *Bytes) AppendInt24LE(value int32)

func (*Bytes) AppendInt32

func (s *Bytes) AppendInt32(value int32)

func (*Bytes) AppendInt32BE

func (s *Bytes) AppendInt32BE(value int32)

func (*Bytes) AppendInt32LE

func (s *Bytes) AppendInt32LE(value int32)

func (*Bytes) AppendInt40

func (s *Bytes) AppendInt40(value int64)

func (*Bytes) AppendInt40BE

func (s *Bytes) AppendInt40BE(value int64)

func (*Bytes) AppendInt40LE

func (s *Bytes) AppendInt40LE(value int64)

func (*Bytes) AppendInt48

func (s *Bytes) AppendInt48(value int64)

func (*Bytes) AppendInt48BE

func (s *Bytes) AppendInt48BE(value int64)

func (*Bytes) AppendInt48LE

func (s *Bytes) AppendInt48LE(value int64)

func (*Bytes) AppendInt56

func (s *Bytes) AppendInt56(value int64)

func (*Bytes) AppendInt56BE

func (s *Bytes) AppendInt56BE(value int64)

func (*Bytes) AppendInt56LE

func (s *Bytes) AppendInt56LE(value int64)

func (*Bytes) AppendInt64

func (s *Bytes) AppendInt64(value int64)

func (*Bytes) AppendInt64BE

func (s *Bytes) AppendInt64BE(value int64)

func (*Bytes) AppendInt64LE

func (s *Bytes) AppendInt64LE(value int64)

func (*Bytes) AppendInt8

func (s *Bytes) AppendInt8(value int8)

func (*Bytes) AppendPointer

func (s *Bytes) AppendPointer(value Pointer)

func (*Bytes) AppendString

func (s *Bytes) AppendString(value string)

func (*Bytes) AppendUInt

func (s *Bytes) AppendUInt(value uint)

func (*Bytes) AppendUInt16

func (s *Bytes) AppendUInt16(value uint16)

func (*Bytes) AppendUInt16BE

func (s *Bytes) AppendUInt16BE(value uint16)

func (*Bytes) AppendUInt16LE

func (s *Bytes) AppendUInt16LE(value uint16)

func (*Bytes) AppendUInt24

func (s *Bytes) AppendUInt24(value uint32)

func (*Bytes) AppendUInt24BE

func (s *Bytes) AppendUInt24BE(value uint32)

func (*Bytes) AppendUInt24LE

func (s *Bytes) AppendUInt24LE(value uint32)

func (*Bytes) AppendUInt32

func (s *Bytes) AppendUInt32(value uint32)

func (*Bytes) AppendUInt32BE

func (s *Bytes) AppendUInt32BE(value uint32)

func (*Bytes) AppendUInt32LE

func (s *Bytes) AppendUInt32LE(value uint32)

func (*Bytes) AppendUInt40

func (s *Bytes) AppendUInt40(value uint64)

func (*Bytes) AppendUInt40BE

func (s *Bytes) AppendUInt40BE(value uint64)

func (*Bytes) AppendUInt40LE

func (s *Bytes) AppendUInt40LE(value uint64)

func (*Bytes) AppendUInt48

func (s *Bytes) AppendUInt48(value uint64)

func (*Bytes) AppendUInt48BE

func (s *Bytes) AppendUInt48BE(value uint64)

func (*Bytes) AppendUInt48LE

func (s *Bytes) AppendUInt48LE(value uint64)

func (*Bytes) AppendUInt56

func (s *Bytes) AppendUInt56(value uint64)

func (*Bytes) AppendUInt56BE

func (s *Bytes) AppendUInt56BE(value uint64)

func (*Bytes) AppendUInt56LE

func (s *Bytes) AppendUInt56LE(value uint64)

func (*Bytes) AppendUInt64

func (s *Bytes) AppendUInt64(value uint64)

func (*Bytes) AppendUInt64BE

func (s *Bytes) AppendUInt64BE(value uint64)

func (*Bytes) AppendUInt64LE

func (s *Bytes) AppendUInt64LE(value uint64)

func (*Bytes) AppendUInt8

func (s *Bytes) AppendUInt8(value uint8)

func (*Bytes) AppendUintptr

func (s *Bytes) AppendUintptr(value uintptr)

func (*Bytes) Byte

func (s *Bytes) Byte(offset int) byte

func (*Bytes) Bytes

func (s *Bytes) Bytes() []byte

func (*Bytes) CString

func (s *Bytes) CString() unsafe.Pointer

func (Bytes) Cap

func (b Bytes) Cap() int

func (*Bytes) CheckBounds

func (s *Bytes) CheckBounds(offset int) bool

func (*Bytes) Clone

func (s *Bytes) Clone() Bytes

Clone creates a copy of this instance of Bytes

func (*Bytes) EnsureCap

func (s *Bytes) EnsureCap(neededCap int) bool

EnsureCap ensures the capacity is at least neededCap in size

func (*Bytes) EnsureLen

func (s *Bytes) EnsureLen(neededLen int)

EnsureLen ensures the length is at least neededLen in size If not, EnsureCap(neededLen) is called and the length set to neededLen.

func (*Bytes) Equals

func (s *Bytes) Equals(o Bytes) bool

func (*Bytes) Float32

func (s *Bytes) Float32(offset int) float32

func (*Bytes) Float32BE

func (s *Bytes) Float32BE(offset int) float32

func (*Bytes) Float32LE

func (s *Bytes) Float32LE(offset int) float32

func (*Bytes) Float64

func (s *Bytes) Float64(offset int) float64

func (*Bytes) Float64BE

func (s *Bytes) Float64BE(offset int) float64

func (*Bytes) Float64LE

func (s *Bytes) Float64LE(offset int) float64

func (*Bytes) Free

func (s *Bytes) Free()

func (*Bytes) Hash32

func (s *Bytes) Hash32() uint32

func (*Bytes) Hash64

func (s *Bytes) Hash64() uint64

func (*Bytes) Int

func (s *Bytes) Int(offset int) int

func (*Bytes) Int16

func (s *Bytes) Int16(offset int) int16

func (*Bytes) Int16BE

func (s *Bytes) Int16BE(offset int) int16

func (*Bytes) Int16LE

func (s *Bytes) Int16LE(offset int) int16

func (*Bytes) Int24

func (s *Bytes) Int24(offset int) int32

func (*Bytes) Int24BE

func (s *Bytes) Int24BE(offset int) int32

func (*Bytes) Int24LE

func (s *Bytes) Int24LE(offset int) int32

func (*Bytes) Int32

func (s *Bytes) Int32(offset int) int32

func (*Bytes) Int32BE

func (s *Bytes) Int32BE(offset int) int32

func (*Bytes) Int32LE

func (s *Bytes) Int32LE(offset int) int32

func (*Bytes) Int40

func (s *Bytes) Int40(offset int) int64

func (*Bytes) Int40BE

func (s *Bytes) Int40BE(offset int) int64

func (*Bytes) Int40LE

func (s *Bytes) Int40LE(offset int) int64

func (*Bytes) Int48

func (s *Bytes) Int48(offset int) int64

func (*Bytes) Int48BE

func (s *Bytes) Int48BE(offset int) int64

func (*Bytes) Int48LE

func (s *Bytes) Int48LE(offset int) int64

func (*Bytes) Int56

func (s *Bytes) Int56(offset int) int64

func (*Bytes) Int56BE

func (s *Bytes) Int56BE(offset int) int64

func (*Bytes) Int56LE

func (s *Bytes) Int56LE(offset int) int64

func (*Bytes) Int64

func (s *Bytes) Int64(offset int) int64

func (*Bytes) Int64BE

func (s *Bytes) Int64BE(offset int) int64

func (*Bytes) Int64LE

func (s *Bytes) Int64LE(offset int) int64

func (*Bytes) Int8

func (s *Bytes) Int8(offset int) int8

func (Bytes) IsEmpty

func (s Bytes) IsEmpty() bool

func (*Bytes) IsNil

func (s *Bytes) IsNil() bool

func (Bytes) Len

func (b Bytes) Len() int

func (*Bytes) Metro64

func (s *Bytes) Metro64(seed uint64, offset, length int) uint64

func (*Bytes) PointerAt

func (s *Bytes) PointerAt(offset int) Pointer

func (*Bytes) Reset

func (s *Bytes) Reset()

Reset zeroes out the entire allocation and sets the length back to 0

func (*Bytes) Set

func (s *Bytes) Set(offset int, value Bytes)

func (*Bytes) SetByte

func (s *Bytes) SetByte(offset int, value byte)

func (*Bytes) SetBytes

func (s *Bytes) SetBytes(offset int, value []byte)

func (*Bytes) SetFloat32

func (s *Bytes) SetFloat32(offset int, value float32)

func (*Bytes) SetFloat32BE

func (s *Bytes) SetFloat32BE(offset int, value float32)

func (*Bytes) SetFloat32LE

func (s *Bytes) SetFloat32LE(offset int, value float32)

func (*Bytes) SetFloat64

func (s *Bytes) SetFloat64(offset int, value float64)

func (*Bytes) SetFloat64BE

func (s *Bytes) SetFloat64BE(offset int, value float64)

func (*Bytes) SetFloat64LE

func (s *Bytes) SetFloat64LE(offset int, value float64)

func (*Bytes) SetInt

func (s *Bytes) SetInt(offset int, value int)

func (*Bytes) SetInt16

func (s *Bytes) SetInt16(offset int, value int16)

func (*Bytes) SetInt16BE

func (s *Bytes) SetInt16BE(offset int, value int16)

func (*Bytes) SetInt16LE

func (s *Bytes) SetInt16LE(offset int, value int16)

func (*Bytes) SetInt24

func (s *Bytes) SetInt24(offset int, value int32)

func (*Bytes) SetInt24BE

func (s *Bytes) SetInt24BE(offset int, value int32)

func (*Bytes) SetInt24LE

func (s *Bytes) SetInt24LE(offset int, value int32)

func (*Bytes) SetInt32

func (s *Bytes) SetInt32(offset int, value int32)

func (*Bytes) SetInt32BE

func (s *Bytes) SetInt32BE(offset int, value int32)

func (*Bytes) SetInt32LE

func (s *Bytes) SetInt32LE(offset int, value int32)

func (*Bytes) SetInt40

func (s *Bytes) SetInt40(offset int, value int64)

func (*Bytes) SetInt40BE

func (s *Bytes) SetInt40BE(offset int, value int64)

func (*Bytes) SetInt40LE

func (s *Bytes) SetInt40LE(offset int, value int64)

func (*Bytes) SetInt48

func (s *Bytes) SetInt48(offset int, value int64)

func (*Bytes) SetInt48BE

func (s *Bytes) SetInt48BE(offset int, value int64)

func (*Bytes) SetInt48LE

func (s *Bytes) SetInt48LE(offset int, value int64)

func (*Bytes) SetInt56

func (s *Bytes) SetInt56(offset int, value int64)

func (*Bytes) SetInt56BE

func (s *Bytes) SetInt56BE(offset int, value int64)

func (*Bytes) SetInt56LE

func (s *Bytes) SetInt56LE(offset int, value int64)

func (*Bytes) SetInt64

func (s *Bytes) SetInt64(offset int, value int64)

func (*Bytes) SetInt64BE

func (s *Bytes) SetInt64BE(offset int, value int64)

func (*Bytes) SetInt64LE

func (s *Bytes) SetInt64LE(offset int, value int64)

func (*Bytes) SetInt8

func (s *Bytes) SetInt8(offset int, value int8)

func (*Bytes) SetLength

func (s *Bytes) SetLength(length int)

func (*Bytes) SetPointer

func (s *Bytes) SetPointer(offset int, value Pointer)

func (*Bytes) SetString

func (s *Bytes) SetString(offset int, value string)

func (*Bytes) SetUInt

func (s *Bytes) SetUInt(offset int, value uint)

func (*Bytes) SetUInt16

func (s *Bytes) SetUInt16(offset int, value uint16)

func (*Bytes) SetUInt16BE

func (s *Bytes) SetUInt16BE(offset int, value uint16)

func (*Bytes) SetUInt16LE

func (s *Bytes) SetUInt16LE(offset int, value uint16)

func (*Bytes) SetUInt24

func (s *Bytes) SetUInt24(offset int, value uint32)

func (*Bytes) SetUInt24BE

func (s *Bytes) SetUInt24BE(offset int, value uint32)

func (*Bytes) SetUInt24LE

func (s *Bytes) SetUInt24LE(offset int, value uint32)

func (*Bytes) SetUInt32

func (s *Bytes) SetUInt32(offset int, value uint32)

func (*Bytes) SetUInt32BE

func (s *Bytes) SetUInt32BE(offset int, value uint32)

func (*Bytes) SetUInt32LE

func (s *Bytes) SetUInt32LE(offset int, value uint32)

func (*Bytes) SetUInt40

func (s *Bytes) SetUInt40(offset int, value uint64)

func (*Bytes) SetUInt40BE

func (s *Bytes) SetUInt40BE(offset int, value uint64)

func (*Bytes) SetUInt40LE

func (s *Bytes) SetUInt40LE(offset int, value uint64)

func (*Bytes) SetUInt48

func (s *Bytes) SetUInt48(offset int, value uint64)

func (*Bytes) SetUInt48BE

func (s *Bytes) SetUInt48BE(offset int, value uint64)

func (*Bytes) SetUInt48LE

func (s *Bytes) SetUInt48LE(offset int, value uint64)

func (*Bytes) SetUInt56

func (s *Bytes) SetUInt56(offset int, value uint64)

func (*Bytes) SetUInt56BE

func (s *Bytes) SetUInt56BE(offset int, value uint64)

func (*Bytes) SetUInt56LE

func (s *Bytes) SetUInt56LE(offset int, value uint64)

func (*Bytes) SetUInt64

func (s *Bytes) SetUInt64(offset int, value uint64)

func (*Bytes) SetUInt64BE

func (s *Bytes) SetUInt64BE(offset int, value uint64)

func (*Bytes) SetUInt64LE

func (s *Bytes) SetUInt64LE(offset int, value uint64)

func (*Bytes) SetUInt8

func (s *Bytes) SetUInt8(offset int, value uint8)

SetUInt8 is safe version. Will grow allocation if needed.

func (*Bytes) SetUintptr

func (s *Bytes) SetUintptr(offset int, value uintptr)

func (*Bytes) String

func (s *Bytes) String() string

func (*Bytes) UInt

func (s *Bytes) UInt(offset int) int

func (*Bytes) UInt16

func (s *Bytes) UInt16(offset int) uint16

func (*Bytes) UInt16BE

func (s *Bytes) UInt16BE(offset int) uint16

func (*Bytes) UInt16LE

func (s *Bytes) UInt16LE(offset int) uint16

func (*Bytes) UInt24

func (s *Bytes) UInt24(offset int) uint32

func (*Bytes) UInt24BE

func (s *Bytes) UInt24BE(offset int) uint32

func (*Bytes) UInt24LE

func (s *Bytes) UInt24LE(offset int) uint32

func (*Bytes) UInt32

func (s *Bytes) UInt32(offset int) uint32

func (*Bytes) UInt32BE

func (s *Bytes) UInt32BE(offset int) uint32

func (*Bytes) UInt32LE

func (s *Bytes) UInt32LE(offset int) uint32

func (*Bytes) UInt40

func (s *Bytes) UInt40(offset int) uint64

func (*Bytes) UInt40BE

func (s *Bytes) UInt40BE(offset int) uint64

func (*Bytes) UInt40LE

func (s *Bytes) UInt40LE(offset int) uint64

func (*Bytes) UInt48

func (s *Bytes) UInt48(offset int) uint64

func (*Bytes) UInt48BE

func (s *Bytes) UInt48BE(offset int) uint64

func (*Bytes) UInt48LE

func (s *Bytes) UInt48LE(offset int) uint64

func (*Bytes) UInt56

func (s *Bytes) UInt56(offset int) uint64

func (*Bytes) UInt56BE

func (s *Bytes) UInt56BE(offset int) uint64

func (*Bytes) UInt56LE

func (s *Bytes) UInt56LE(offset int) uint64

func (*Bytes) UInt64

func (s *Bytes) UInt64(offset int) uint64

func (*Bytes) UInt64BE

func (s *Bytes) UInt64BE(offset int) uint64

func (*Bytes) UInt64LE

func (s *Bytes) UInt64LE(offset int) uint64

func (*Bytes) UInt8

func (s *Bytes) UInt8(offset int) uint8

func (*Bytes) Uintptr

func (s *Bytes) Uintptr(offset int) uintptr

func (*Bytes) WyHash64

func (s *Bytes) WyHash64(seed uint64, offset, length int) uint64

func (Bytes) Zero

func (s Bytes) Zero()

Zero zeroes out the entire allocation.

type FatPointer

type FatPointer struct {
	Pointer
	// contains filtered or unexported fields
}

func FatPointerOf

func FatPointerOf(p Pointer, length uintptr) FatPointer

func (FatPointer) Bytes

func (fp FatPointer) Bytes() []byte

func (FatPointer) Clone

func (fp FatPointer) Clone() FatPointer

func (FatPointer) CloneAsBytes

func (fp FatPointer) CloneAsBytes() Bytes

func (*FatPointer) Len

func (fp *FatPointer) Len() uintptr

func (FatPointer) String

func (fp FatPointer) String() string

type GCObject

type GCObject uintptr

func (GCObject) Ptr

func (o GCObject) Ptr() Pointer

type GCStats

type GCStats struct {
	Started           int64   // Epoch in nanos when GC was first started
	Cycles            int64   // Number of times GC collect Has ran
	Live              int64   // Number of live objects
	TotalAllocs       int64   // Count of all allocations created
	TotalBytes        int64   // Sum of all allocation's size in bytes
	Frees             int64   // Count of times an allocation was freed instead of swept
	FreedBytes        int64   // Sum of all freed allocation's size in bytes
	Sweeps            int64   // Count of times an allocation was swept instead of freed
	SweepBytes        int64   // Sum of all swept allocation's size in bytes
	SweepTime         int64   // Sum of all time in nanos spent during the Sweep phase
	SweepTimeMin      int64   // Minimum time in nanos spent during a single Sweep phase
	SweepTimeMax      int64   // Maximum time in nanos spent during a single Sweep phase
	SweepTimeAvg      int64   // Average time in nanos spent during a single Sweep phase
	Roots             int64   //
	RootsMin          int64   //
	RootsMax          int64   //
	RootsTimeMin      int64   //
	RootsTimeMax      int64   //
	RootsTimeAvg      int64   //
	GraphDepth        int64   //
	GraphMinDepth     int64   //
	GraphMaxDepth     int64   //
	GraphAvgDepth     int64   //
	GraphTimeMin      int64   //
	GraphTimeMax      int64   //
	GraphTimeAvg      int64   //
	TotalTime         int64   // Sum of all time in nanos spent doing GC collect
	MinTime           int64   // Minimum time in nanos spent during a single GC collect
	MaxTime           int64   // Maximum time in nanos spent during a single GC collect
	AvgTime           int64   // Average time in nanos spent during a single GC collect
	LastMarkRootsTime int64   // Time in nanos spent during the most recent GC collect "Mark Roots" phase
	LastMarkGraphTime int64   // Time in nanos spent during the most recent GC collect "Mark Graph" phase
	LastSweepTime     int64   // Time in nanos spent during the most recent GC collect "Sweep" phase
	LastGCTime        int64   // Time in nanos spent during the most recent GC collect
	LastSweep         int64   // Number of allocations that were swept during the most recent GC collect "Sweep" phase
	LastSweepBytes    int64   // Number of bytes reclaimed during the most recent GC collect "Sweep" phase
	LiveBytes         uintptr // Sum of all live allocation's size in bytes
}

GCStats provides all the monitoring metrics needed to see how the GC is operating and performing.

func (*GCStats) Print

func (s *GCStats) Print()

type HeapStats

type HeapStats struct {
	HeapSize        int64
	AllocSize       int64
	PeakAllocSize   int64
	FreeSize        int64
	Allocs          int32
	InitialPages    int32
	ConsecutiveLow  int32
	ConsecutiveHigh int32
	Pages           int32
	Grows           int32
	// contains filtered or unexported fields
}

HeapStats provides the metrics of an Allocator

func (*HeapStats) Fragmentation

func (s *HeapStats) Fragmentation() float32

type Pointer

type Pointer uintptr

Pointer is a wrapper around a raw pointer that is not unsafe.Pointer so Go won't confuse it for a potential GC managed pointer.

func Alloc

func Alloc(size uintptr) Pointer

Alloc calls Alloc on the system allocator

func AllocCap

func AllocCap(size uintptr) (Pointer, uintptr)

func AllocZeroed

func AllocZeroed(size uintptr) Pointer

func AllocZeroedCap

func AllocZeroedCap(size uintptr) (Pointer, uintptr)

func Calloc

func Calloc(num, size uintptr) Pointer

Alloc calls Alloc on the system allocator

func CallocCap

func CallocCap(num, size uintptr) (Pointer, uintptr)

func Realloc

func Realloc(p Pointer, size uintptr) Pointer

Realloc calls Realloc on the system allocator

func ReallocCap

func ReallocCap(p Pointer, size uintptr) (Pointer, uintptr)

func (Pointer) Add

func (p Pointer) Add(offset int) Pointer

Add is Pointer arithmetic.

func (Pointer) Byte

func (p Pointer) Byte(offset int) byte

func (Pointer) Bytes

func (p Pointer) Bytes(offset, length, capacity int) []byte

func (Pointer) Clone

func (p Pointer) Clone(offset, size int) Pointer

Clone the memory starting at offset for size number of bytes and return the new Pointer.

func (Pointer) Compare

func (p Pointer) Compare(offset, size int, to Pointer) int

Compare does a memcmp

func (Pointer) Copy

func (p Pointer) Copy(offset, size int, to Pointer)

Copy does a memcpy

func (Pointer) Equals

func (p Pointer) Equals(offset, size int, to Pointer) bool

Equals does a memequal

func (Pointer) Float32

func (p Pointer) Float32(offset int) float32

func (Pointer) Float32BE

func (p Pointer) Float32BE(offset int) float32

func (Pointer) Float32LE

func (p Pointer) Float32LE(offset int) float32

func (Pointer) Float64

func (p Pointer) Float64(offset int) float64

func (Pointer) Float64BE

func (p Pointer) Float64BE(offset int) float64

func (Pointer) Float64LE

func (p Pointer) Float64LE(offset int) float64

func (*Pointer) Free

func (p *Pointer) Free()

Free deallocates memory pointed by Pointer

func (Pointer) Hash32

func (p Pointer) Hash32(length int) uint32

func (Pointer) Hash32At

func (p Pointer) Hash32At(offset, length int) uint32

func (Pointer) Hash64

func (p Pointer) Hash64(length int) uint64

func (Pointer) Hash64At

func (p Pointer) Hash64At(offset, length int) uint64

func (Pointer) Int

func (p Pointer) Int(offset int) int

func (Pointer) Int16

func (p Pointer) Int16(offset int) int16

func (Pointer) Int16BE

func (p Pointer) Int16BE(offset int) int16

func (Pointer) Int16LE

func (p Pointer) Int16LE(offset int) int16

func (Pointer) Int24

func (p Pointer) Int24(offset int) int32

func (Pointer) Int24BE

func (p Pointer) Int24BE(offset int) int32

func (Pointer) Int24LE

func (p Pointer) Int24LE(offset int) int32

func (Pointer) Int32

func (p Pointer) Int32(offset int) int32

func (Pointer) Int32BE

func (p Pointer) Int32BE(offset int) int32

func (Pointer) Int32LE

func (p Pointer) Int32LE(offset int) int32

func (Pointer) Int40

func (p Pointer) Int40(offset int) int64

func (Pointer) Int40BE

func (p Pointer) Int40BE(offset int) int64

func (Pointer) Int40LE

func (p Pointer) Int40LE(offset int) int64

func (Pointer) Int48

func (p Pointer) Int48(offset int) int64

func (Pointer) Int48BE

func (p Pointer) Int48BE(offset int) int64

func (Pointer) Int48LE

func (p Pointer) Int48LE(offset int) int64

func (Pointer) Int56

func (p Pointer) Int56(offset int) int64

func (Pointer) Int56BE

func (p Pointer) Int56BE(offset int) int64

func (Pointer) Int56LE

func (p Pointer) Int56LE(offset int) int64

func (Pointer) Int64

func (p Pointer) Int64(offset int) int64

func (Pointer) Int64BE

func (p Pointer) Int64BE(offset int) int64

func (Pointer) Int64LE

func (p Pointer) Int64LE(offset int) int64

func (Pointer) Int8

func (p Pointer) Int8(offset int) int8

func (Pointer) Metro64

func (p Pointer) Metro64(seed uint64, offset, length int) uint64

func (Pointer) Move

func (p Pointer) Move(offset, size int, to Pointer)

Move does a memmove

func (Pointer) Pointer

func (p Pointer) Pointer(offset int) Pointer

func (Pointer) SetByte

func (p Pointer) SetByte(offset int, v byte)

func (Pointer) SetBytes

func (p Pointer) SetBytes(offset int, value []byte)

func (Pointer) SetFloat32

func (p Pointer) SetFloat32(offset int, v float32)

func (Pointer) SetFloat32BE

func (p Pointer) SetFloat32BE(offset int, v float32)

func (Pointer) SetFloat32LE

func (p Pointer) SetFloat32LE(offset int, v float32)

func (Pointer) SetFloat64

func (p Pointer) SetFloat64(offset int, v float64)

func (Pointer) SetFloat64BE

func (p Pointer) SetFloat64BE(offset int, v float64)

func (Pointer) SetFloat64LE

func (p Pointer) SetFloat64LE(offset int, v float64)

func (Pointer) SetInt

func (p Pointer) SetInt(offset int, v int)

func (Pointer) SetInt16

func (p Pointer) SetInt16(offset int, v int16)

func (Pointer) SetInt16BE

func (p Pointer) SetInt16BE(offset int, v int16)

func (Pointer) SetInt16LE

func (p Pointer) SetInt16LE(offset int, v int16)

func (Pointer) SetInt24

func (p Pointer) SetInt24(offset int, v int32)

func (Pointer) SetInt24BE

func (p Pointer) SetInt24BE(offset int, v int32)

func (Pointer) SetInt24LE

func (p Pointer) SetInt24LE(offset int, v int32)

func (Pointer) SetInt32

func (p Pointer) SetInt32(offset int, v int32)

func (Pointer) SetInt32BE

func (p Pointer) SetInt32BE(offset int, v int32)

func (Pointer) SetInt32LE

func (p Pointer) SetInt32LE(offset int, v int32)

func (Pointer) SetInt40

func (p Pointer) SetInt40(offset int, v int64)

func (Pointer) SetInt40BE

func (p Pointer) SetInt40BE(offset int, v int64)

func (Pointer) SetInt40LE

func (p Pointer) SetInt40LE(offset int, v int64)

func (Pointer) SetInt48

func (p Pointer) SetInt48(offset int, v int64)

func (Pointer) SetInt48BE

func (p Pointer) SetInt48BE(offset int, v int64)

func (Pointer) SetInt48LE

func (p Pointer) SetInt48LE(offset int, v int64)

func (Pointer) SetInt56

func (p Pointer) SetInt56(offset int, v int64)

func (Pointer) SetInt56BE

func (p Pointer) SetInt56BE(offset int, v int64)

func (Pointer) SetInt56LE

func (p Pointer) SetInt56LE(offset int, v int64)

func (Pointer) SetInt64

func (p Pointer) SetInt64(offset int, v int64)

func (Pointer) SetInt64BE

func (p Pointer) SetInt64BE(offset int, v int64)

func (Pointer) SetInt64LE

func (p Pointer) SetInt64LE(offset int, v int64)

func (Pointer) SetInt8

func (p Pointer) SetInt8(offset int, v int8)

func (Pointer) SetPointer

func (p Pointer) SetPointer(offset int, v Pointer)

func (Pointer) SetString

func (p Pointer) SetString(offset int, value string)

func (Pointer) SetUInt

func (p Pointer) SetUInt(offset int, v uint)

func (Pointer) SetUInt16

func (p Pointer) SetUInt16(offset int, v uint16)

func (Pointer) SetUInt16BE

func (p Pointer) SetUInt16BE(offset int, v uint16)

func (Pointer) SetUInt16LE

func (p Pointer) SetUInt16LE(offset int, v uint16)

func (Pointer) SetUInt24

func (p Pointer) SetUInt24(offset int, v uint32)

func (Pointer) SetUInt24BE

func (p Pointer) SetUInt24BE(offset int, v uint32)

func (Pointer) SetUInt24LE

func (p Pointer) SetUInt24LE(offset int, v uint32)

func (Pointer) SetUInt32

func (p Pointer) SetUInt32(offset int, v uint32)

func (Pointer) SetUInt32BE

func (p Pointer) SetUInt32BE(offset int, v uint32)

func (Pointer) SetUInt32LE

func (p Pointer) SetUInt32LE(offset int, v uint32)

func (Pointer) SetUInt40

func (p Pointer) SetUInt40(offset int, v uint64)

func (Pointer) SetUInt40BE

func (p Pointer) SetUInt40BE(offset int, v uint64)

func (Pointer) SetUInt40LE

func (p Pointer) SetUInt40LE(offset int, v uint64)

func (Pointer) SetUInt48

func (p Pointer) SetUInt48(offset int, v uint64)

func (Pointer) SetUInt48BE

func (p Pointer) SetUInt48BE(offset int, v uint64)

func (Pointer) SetUInt48LE

func (p Pointer) SetUInt48LE(offset int, v uint64)

func (Pointer) SetUInt56

func (p Pointer) SetUInt56(offset int, v uint64)

func (Pointer) SetUInt56BE

func (p Pointer) SetUInt56BE(offset int, v uint64)

func (Pointer) SetUInt56LE

func (p Pointer) SetUInt56LE(offset int, v uint64)

func (Pointer) SetUInt64

func (p Pointer) SetUInt64(offset int, v uint64)

func (Pointer) SetUInt64BE

func (p Pointer) SetUInt64BE(offset int, v uint64)

func (Pointer) SetUInt64LE

func (p Pointer) SetUInt64LE(offset int, v uint64)

func (Pointer) SetUInt8

func (p Pointer) SetUInt8(offset int, v uint8)

func (Pointer) SetUintptr

func (p Pointer) SetUintptr(offset int, v uintptr)

func (Pointer) SizeOf

func (p Pointer) SizeOf() uintptr

SizeOf returns the size of the allocation provided by the platform allocator.

func (Pointer) String

func (p Pointer) String(offset, size int) string

func (Pointer) ToFat

func (p Pointer) ToFat(length int) FatPointer

func (Pointer) UInt

func (p Pointer) UInt(offset int) uint

func (Pointer) UInt16

func (p Pointer) UInt16(offset int) uint16

func (Pointer) UInt16BE

func (p Pointer) UInt16BE(offset int) uint16

func (Pointer) UInt16LE

func (p Pointer) UInt16LE(offset int) uint16

func (Pointer) UInt24

func (p Pointer) UInt24(offset int) uint32

func (Pointer) UInt24BE

func (p Pointer) UInt24BE(offset int) uint32

func (Pointer) UInt24LE

func (p Pointer) UInt24LE(offset int) uint32

func (Pointer) UInt32

func (p Pointer) UInt32(offset int) uint32

func (Pointer) UInt32BE

func (p Pointer) UInt32BE(offset int) uint32

func (Pointer) UInt32BESlow

func (p Pointer) UInt32BESlow() uint32

func (Pointer) UInt32LE

func (p Pointer) UInt32LE(offset int) uint32

func (Pointer) UInt40

func (p Pointer) UInt40(offset int) uint64

func (Pointer) UInt40BE

func (p Pointer) UInt40BE(offset int) uint64

func (Pointer) UInt40LE

func (p Pointer) UInt40LE(offset int) uint64

func (Pointer) UInt48

func (p Pointer) UInt48(offset int) uint64

func (Pointer) UInt48BE

func (p Pointer) UInt48BE(offset int) uint64

func (Pointer) UInt48LE

func (p Pointer) UInt48LE(offset int) uint64

func (Pointer) UInt56

func (p Pointer) UInt56(offset int) uint64

func (Pointer) UInt56BE

func (p Pointer) UInt56BE(offset int) uint64

func (Pointer) UInt56LE

func (p Pointer) UInt56LE(offset int) uint64

func (Pointer) UInt64

func (p Pointer) UInt64(offset int) uint64

func (Pointer) UInt64BE

func (p Pointer) UInt64BE(offset int) uint64

func (Pointer) UInt64LE

func (p Pointer) UInt64LE(offset int) uint64

func (Pointer) UInt8

func (p Pointer) UInt8(offset int) uint8

func (Pointer) Uintptr

func (p Pointer) Uintptr(offset int) uintptr

func (Pointer) Unsafe

func (p Pointer) Unsafe() unsafe.Pointer

func (Pointer) WyHash64

func (p Pointer) WyHash64(seed uint64, offset, length int) uint64

func (Pointer) Zero

func (p Pointer) Zero(size uintptr)

Zero zeroes out the entire allocation.

type PointerSet

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

PointerSet is a hashset that uses the robinhood algorithm. This implementation is not concurrent safe.

func NewPointerSet

func NewPointerSet(size uintptr) PointerSet

NewPointerSet returns a new robinhood hashmap.

func (*PointerSet) Add

func (ps *PointerSet) Add(key uintptr, depth int) (bool, bool)

Add inserts or updates a key into the PointerSet. The returned wasNew will be true if the mutation was on a newly seen, inserted key, and wasNew will be false if the mutation was an update to an existing key.

func (*PointerSet) Close

func (ps *PointerSet) Close() error

func (*PointerSet) Delete

func (ps *PointerSet) Delete(key uintptr) (uintptr, bool)

Delete removes a key from the PointerSet.

func (*PointerSet) Grow

func (ps *PointerSet) Grow() bool

func (*PointerSet) Has

func (ps *PointerSet) Has(key uintptr) bool

Has returns whether the key exists in the Add.

func (*PointerSet) Reset

func (ps *PointerSet) Reset()

Reset clears PointerSet, where already allocated memory will be reused.

func (*PointerSet) Set

func (ps *PointerSet) Set(key uintptr) (bool, bool)

Directories

Path Synopsis
alloc
collections
art
art/cmd command
rax
net
storage
btree2
Package lmdb provides bindings to the lmdb C API.
Package lmdb provides bindings to the lmdb C API.
cgo
cmd command

Jump to

Keyboard shortcuts

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