Documentation ¶
Index ¶
- Constants
- Variables
- func Cmp(a, b string) int
- func Compare(a, b unsafe.Pointer, n uintptr) int
- func Copy(dst, src unsafe.Pointer, n uintptr)
- func Equals(a, b unsafe.Pointer, size uintptr) bool
- func Fastrand() uint32
- func FloorToPowerOfTwo(n int) int
- func Free(p Pointer)
- func Init()
- func IsPowerOfTwo(n int) bool
- func LogarithmicRange(min, max int, cb func(int))
- func Move(to, from unsafe.Pointer, n uintptr)
- func PrintGCStats()
- func Scope(fn func(a AutoFree))
- func Sizeof(ptr Pointer) uintptr
- func Zero(ptr unsafe.Pointer, n uintptr)
- type AutoFree
- func (af AutoFree) Alloc(size uintptr) Pointer
- func (af AutoFree) AllocCap(size uintptr) FatPointer
- func (af AutoFree) Bytes(size uintptr) Bytes
- func (af *AutoFree) Close() error
- func (af AutoFree) Count() uintptr
- func (af *AutoFree) Free()
- func (af *AutoFree) HasNext() bool
- func (af AutoFree) Max() uintptr
- func (af *AutoFree) Next() AutoFree
- func (af *AutoFree) Print()
- func (af *AutoFree) Scope(fn func(AutoFree))
- func (af AutoFree) Size() uintptr
- type Bytes
- func (s *Bytes) Append(value Bytes)
- func (s *Bytes) AppendByte(value byte)
- func (s *Bytes) AppendByteString(value byte)
- func (s *Bytes) AppendBytes(value []byte)
- func (s *Bytes) AppendFloat32(value float32)
- func (s *Bytes) AppendFloat32BE(value float32)
- func (s *Bytes) AppendFloat32LE(value float32)
- func (s *Bytes) AppendFloat32String(value float32)
- func (s *Bytes) AppendFloat64(value float64)
- func (s *Bytes) AppendFloat64BE(value float64)
- func (s *Bytes) AppendFloat64LE(value float64)
- func (s *Bytes) AppendFloat64String(value float64)
- func (s *Bytes) AppendInt(value int)
- func (s *Bytes) AppendInt16(value int16)
- func (s *Bytes) AppendInt16BE(value int16)
- func (s *Bytes) AppendInt16LE(value int16)
- func (s *Bytes) AppendInt16String(value int16)
- func (s *Bytes) AppendInt24(value int32)
- func (s *Bytes) AppendInt24BE(value int32)
- func (s *Bytes) AppendInt24LE(value int32)
- func (s *Bytes) AppendInt32(value int32)
- func (s *Bytes) AppendInt32BE(value int32)
- func (s *Bytes) AppendInt32LE(value int32)
- func (s *Bytes) AppendInt32String(value int32)
- func (s *Bytes) AppendInt40(value int64)
- func (s *Bytes) AppendInt40BE(value int64)
- func (s *Bytes) AppendInt40LE(value int64)
- func (s *Bytes) AppendInt48(value int64)
- func (s *Bytes) AppendInt48BE(value int64)
- func (s *Bytes) AppendInt48LE(value int64)
- func (s *Bytes) AppendInt56(value int64)
- func (s *Bytes) AppendInt56BE(value int64)
- func (s *Bytes) AppendInt56LE(value int64)
- func (s *Bytes) AppendInt64(value int64)
- func (s *Bytes) AppendInt64BE(value int64)
- func (s *Bytes) AppendInt64LE(value int64)
- func (s *Bytes) AppendInt64String(value int64)
- func (s *Bytes) AppendInt8(value int8)
- func (s *Bytes) AppendInt8String(value int8)
- func (s *Bytes) AppendIntString(value int)
- func (s *Bytes) AppendPointer(value Pointer)
- func (s *Bytes) AppendString(value string)
- func (s *Bytes) AppendUint(value uint)
- func (s *Bytes) AppendUint16(value uint16)
- func (s *Bytes) AppendUint16BE(value uint16)
- func (s *Bytes) AppendUint16LE(value uint16)
- func (s *Bytes) AppendUint16String(value uint16)
- func (s *Bytes) AppendUint24(value uint32)
- func (s *Bytes) AppendUint24BE(value uint32)
- func (s *Bytes) AppendUint24LE(value uint32)
- func (s *Bytes) AppendUint32(value uint32)
- func (s *Bytes) AppendUint32BE(value uint32)
- func (s *Bytes) AppendUint32LE(value uint32)
- func (s *Bytes) AppendUint32String(value uint32)
- func (s *Bytes) AppendUint40(value uint64)
- func (s *Bytes) AppendUint40BE(value uint64)
- func (s *Bytes) AppendUint40LE(value uint64)
- func (s *Bytes) AppendUint48(value uint64)
- func (s *Bytes) AppendUint48BE(value uint64)
- func (s *Bytes) AppendUint48LE(value uint64)
- func (s *Bytes) AppendUint56(value uint64)
- func (s *Bytes) AppendUint56BE(value uint64)
- func (s *Bytes) AppendUint56LE(value uint64)
- func (s *Bytes) AppendUint64(value uint64)
- func (s *Bytes) AppendUint64BE(value uint64)
- func (s *Bytes) AppendUint64LE(value uint64)
- func (s *Bytes) AppendUint64String(value uint64)
- func (s *Bytes) AppendUint8(value uint8)
- func (s *Bytes) AppendUint8String(value uint8)
- func (s *Bytes) AppendUintString(value uint)
- func (s *Bytes) AppendUintptr(value uintptr)
- func (s *Bytes) Byte(offset int) byte
- func (s *Bytes) Bytes() []byte
- func (s *Bytes) CString() unsafe.Pointer
- func (b Bytes) Cap() int
- func (s *Bytes) CheckBounds(offset int) bool
- func (s *Bytes) Clone() Bytes
- func (s *Bytes) EnsureCap(neededCap int)
- func (s *Bytes) EnsureLen(neededLen int)
- func (s *Bytes) Equals(o Bytes) bool
- func (s *Bytes) Float32(offset int) float32
- func (s *Bytes) Float32BE(offset int) float32
- func (s *Bytes) Float32LE(offset int) float32
- func (s *Bytes) Float64(offset int) float64
- func (s *Bytes) Float64BE(offset int) float64
- func (s *Bytes) Float64LE(offset int) float64
- func (s *Bytes) Free()
- func (s *Bytes) Hash32() uint32
- func (s *Bytes) Hash64() uint64
- func (s *Bytes) Int(offset int) int
- func (s *Bytes) Int16(offset int) int16
- func (s *Bytes) Int16BE(offset int) int16
- func (s *Bytes) Int16LE(offset int) int16
- func (s *Bytes) Int24(offset int) int32
- func (s *Bytes) Int24BE(offset int) int32
- func (s *Bytes) Int24LE(offset int) int32
- func (s *Bytes) Int32(offset int) int32
- func (s *Bytes) Int32BE(offset int) int32
- func (s *Bytes) Int32LE(offset int) int32
- func (s *Bytes) Int40(offset int) int64
- func (s *Bytes) Int40BE(offset int) int64
- func (s *Bytes) Int40LE(offset int) int64
- func (s *Bytes) Int48(offset int) int64
- func (s *Bytes) Int48BE(offset int) int64
- func (s *Bytes) Int48LE(offset int) int64
- func (s *Bytes) Int56(offset int) int64
- func (s *Bytes) Int56BE(offset int) int64
- func (s *Bytes) Int56LE(offset int) int64
- func (s *Bytes) Int64(offset int) int64
- func (s *Bytes) Int64BE(offset int) int64
- func (s *Bytes) Int64LE(offset int) int64
- func (s *Bytes) Int8(offset int) int8
- func (s Bytes) IsEmpty() bool
- func (s *Bytes) IsNil() bool
- func (b Bytes) Len() int
- func (s *Bytes) Metro64(seed uint64, offset, length int) uint64
- func (s *Bytes) PointerAt(offset int) Pointer
- func (s *Bytes) Reset()
- func (s *Bytes) Set(offset int, value Bytes)
- func (s *Bytes) SetByte(offset int, value byte)
- func (s *Bytes) SetBytes(offset int, value []byte)
- func (s *Bytes) SetFloat32(offset int, value float32)
- func (s *Bytes) SetFloat32BE(offset int, value float32)
- func (s *Bytes) SetFloat32LE(offset int, value float32)
- func (s *Bytes) SetFloat64(offset int, value float64)
- func (s *Bytes) SetFloat64BE(offset int, value float64)
- func (s *Bytes) SetFloat64LE(offset int, value float64)
- func (s *Bytes) SetInt(offset int, value int)
- func (s *Bytes) SetInt16(offset int, value int16)
- func (s *Bytes) SetInt16BE(offset int, value int16)
- func (s *Bytes) SetInt16LE(offset int, value int16)
- func (s *Bytes) SetInt24(offset int, value int32)
- func (s *Bytes) SetInt24BE(offset int, value int32)
- func (s *Bytes) SetInt24LE(offset int, value int32)
- func (s *Bytes) SetInt32(offset int, value int32)
- func (s *Bytes) SetInt32BE(offset int, value int32)
- func (s *Bytes) SetInt32LE(offset int, value int32)
- func (s *Bytes) SetInt40(offset int, value int64)
- func (s *Bytes) SetInt40BE(offset int, value int64)
- func (s *Bytes) SetInt40LE(offset int, value int64)
- func (s *Bytes) SetInt48(offset int, value int64)
- func (s *Bytes) SetInt48BE(offset int, value int64)
- func (s *Bytes) SetInt48LE(offset int, value int64)
- func (s *Bytes) SetInt56(offset int, value int64)
- func (s *Bytes) SetInt56BE(offset int, value int64)
- func (s *Bytes) SetInt56LE(offset int, value int64)
- func (s *Bytes) SetInt64(offset int, value int64)
- func (s *Bytes) SetInt64BE(offset int, value int64)
- func (s *Bytes) SetInt64LE(offset int, value int64)
- func (s *Bytes) SetInt8(offset int, value int8)
- func (s *Bytes) SetLength(length int)
- func (s *Bytes) SetPointer(offset int, value Pointer)
- func (s *Bytes) SetString(offset int, value string)
- func (s *Bytes) SetUint(offset int, value uint)
- func (s *Bytes) SetUint16(offset int, value uint16)
- func (s *Bytes) SetUint16BE(offset int, value uint16)
- func (s *Bytes) SetUint16LE(offset int, value uint16)
- func (s *Bytes) SetUint24(offset int, value uint32)
- func (s *Bytes) SetUint24BE(offset int, value uint32)
- func (s *Bytes) SetUint24LE(offset int, value uint32)
- func (s *Bytes) SetUint32(offset int, value uint32)
- func (s *Bytes) SetUint32BE(offset int, value uint32)
- func (s *Bytes) SetUint32LE(offset int, value uint32)
- func (s *Bytes) SetUint40(offset int, value uint64)
- func (s *Bytes) SetUint40BE(offset int, value uint64)
- func (s *Bytes) SetUint40LE(offset int, value uint64)
- func (s *Bytes) SetUint48(offset int, value uint64)
- func (s *Bytes) SetUint48BE(offset int, value uint64)
- func (s *Bytes) SetUint48LE(offset int, value uint64)
- func (s *Bytes) SetUint56(offset int, value uint64)
- func (s *Bytes) SetUint56BE(offset int, value uint64)
- func (s *Bytes) SetUint56LE(offset int, value uint64)
- func (s *Bytes) SetUint64(offset int, value uint64)
- func (s *Bytes) SetUint64BE(offset int, value uint64)
- func (s *Bytes) SetUint64LE(offset int, value uint64)
- func (s *Bytes) SetUint8(offset int, value uint8)
- func (s *Bytes) SetUintptr(offset int, value uintptr)
- func (s *Bytes) String() string
- func (s *Bytes) Uint(offset int) int
- func (s *Bytes) Uint16(offset int) uint16
- func (s *Bytes) Uint16BE(offset int) uint16
- func (s *Bytes) Uint16LE(offset int) uint16
- func (s *Bytes) Uint24(offset int) uint32
- func (s *Bytes) Uint24BE(offset int) uint32
- func (s *Bytes) Uint24LE(offset int) uint32
- func (s *Bytes) Uint32(offset int) uint32
- func (s *Bytes) Uint32BE(offset int) uint32
- func (s *Bytes) Uint32LE(offset int) uint32
- func (s *Bytes) Uint40(offset int) uint64
- func (s *Bytes) Uint40BE(offset int) uint64
- func (s *Bytes) Uint40LE(offset int) uint64
- func (s *Bytes) Uint48(offset int) uint64
- func (s *Bytes) Uint48BE(offset int) uint64
- func (s *Bytes) Uint48LE(offset int) uint64
- func (s *Bytes) Uint56(offset int) uint64
- func (s *Bytes) Uint56BE(offset int) uint64
- func (s *Bytes) Uint56LE(offset int) uint64
- func (s *Bytes) Uint64(offset int) uint64
- func (s *Bytes) Uint64BE(offset int) uint64
- func (s *Bytes) Uint64LE(offset int) uint64
- func (s *Bytes) Uint8(offset int) uint8
- func (s *Bytes) Uintptr(offset int) uintptr
- func (s *Bytes) WyHash64(seed uint64, offset, length int) uint64
- func (s Bytes) Zero()
- type FatPointer
- func FatPointerOf(p Pointer, length uintptr) FatPointer
- func FatPointerOfBool(v *bool) FatPointer
- func FatPointerOfBytes(v []byte) FatPointer
- func FatPointerOfBytesRef(v *[]byte) FatPointer
- func FatPointerOfFloat32(v *float32) FatPointer
- func FatPointerOfFloat64(v *float64) FatPointer
- func FatPointerOfInt16(v *int16) FatPointer
- func FatPointerOfInt32(v *int32) FatPointer
- func FatPointerOfInt64(v *int64) FatPointer
- func FatPointerOfInt8(v *int8) FatPointer
- func FatPointerOfString(s string) FatPointer
- func FatPointerOfStringRef(s *string) FatPointer
- func FatPointerOfUInt16(v *uint16) FatPointer
- func FatPointerOfUInt32(v *uint32) FatPointer
- func FatPointerOfUInt64(v *uint64) FatPointer
- func FatPointerOfUInt8(v *uint8) FatPointer
- type HeapStats
- type Pointer
- func Alloc(size uintptr) Pointer
- func AllocCap(size uintptr) (Pointer, uintptr)
- func AllocZeroed(size uintptr) Pointer
- func AllocZeroedCap(size uintptr) (Pointer, uintptr)
- func Calloc(num, size uintptr) Pointer
- func CallocCap(num, size uintptr) (Pointer, uintptr)
- func PointerOfString(s string) Pointer
- func Realloc(p Pointer, size uintptr) Pointer
- func ReallocCap(p Pointer, size uintptr) (Pointer, uintptr)
- func (p Pointer) Add(offset int) Pointer
- func (p Pointer) AsFloat32BE() float32
- func (p Pointer) AsFloat32LE() float32
- func (p Pointer) AsFloat64BE() float64
- func (p Pointer) AsFloat64LE() float64
- func (p Pointer) AsInt16BE() int16
- func (p Pointer) AsInt16LE() int16
- func (p Pointer) AsInt32BE() int32
- func (p Pointer) AsInt32LE() int32
- func (p Pointer) AsInt64BE() int64
- func (p Pointer) AsInt64LE() int64
- func (p Pointer) AsUint16BE() uint16
- func (p Pointer) AsUint16LE() uint16
- func (p Pointer) AsUint32BE() uint32
- func (p Pointer) AsUint32LE() uint32
- func (p Pointer) AsUint64BE() uint64
- func (p Pointer) AsUint64LE() uint64
- func (p Pointer) Byte(offset int) byte
- func (p Pointer) Bytes(offset, length, capacity int) []byte
- func (p Pointer) Clone(offset, size int) Pointer
- func (p Pointer) Compare(offset, size int, to Pointer) int
- func (p Pointer) Copy(offset, size int, to Pointer)
- func (p Pointer) Equals(offset, size int, to Pointer) bool
- func (p Pointer) Float32(offset int) float32
- func (p Pointer) Float32BE(offset int) float32
- func (p Pointer) Float32LE(offset int) float32
- func (p Pointer) Float64(offset int) float64
- func (p Pointer) Float64BE(offset int) float64
- func (p Pointer) Float64LE(offset int) float64
- func (p *Pointer) Free()
- func (p Pointer) Hash32(length int) uint32
- func (p Pointer) Hash32At(offset, length int) uint32
- func (p Pointer) Hash64(length int) uint64
- func (p Pointer) Hash64At(offset, length int) uint64
- func (p Pointer) Int(offset int) int
- func (p Pointer) Int16(offset int) int16
- func (p Pointer) Int16BE(offset int) int16
- func (p Pointer) Int16LE(offset int) int16
- func (p Pointer) Int24(offset int) int32
- func (p Pointer) Int24BE(offset int) int32
- func (p Pointer) Int24LE(offset int) int32
- func (p Pointer) Int32(offset int) int32
- func (p Pointer) Int32BE(offset int) int32
- func (p Pointer) Int32LE(offset int) int32
- func (p Pointer) Int40(offset int) int64
- func (p Pointer) Int40BE(offset int) int64
- func (p Pointer) Int40LE(offset int) int64
- func (p Pointer) Int48(offset int) int64
- func (p Pointer) Int48BE(offset int) int64
- func (p Pointer) Int48LE(offset int) int64
- func (p Pointer) Int56(offset int) int64
- func (p Pointer) Int56BE(offset int) int64
- func (p Pointer) Int56LE(offset int) int64
- func (p Pointer) Int64(offset int) int64
- func (p Pointer) Int64BE(offset int) int64
- func (p Pointer) Int64LE(offset int) int64
- func (p Pointer) Int8(offset int) int8
- func (p Pointer) Metro64(seed uint64, offset, length int) uint64
- func (p Pointer) Move(offset, size int, to Pointer)
- func (p Pointer) Pointer(offset int) Pointer
- func (p Pointer) SetByte(offset int, v byte)
- func (p Pointer) SetBytes(offset int, value []byte)
- func (p Pointer) SetFloat32(offset int, v float32)
- func (p Pointer) SetFloat32BE(offset int, v float32)
- func (p Pointer) SetFloat32LE(offset int, v float32)
- func (p Pointer) SetFloat64(offset int, v float64)
- func (p Pointer) SetFloat64BE(offset int, v float64)
- func (p Pointer) SetFloat64LE(offset int, v float64)
- func (p Pointer) SetInt(offset int, v int)
- func (p Pointer) SetInt16(offset int, v int16)
- func (p Pointer) SetInt16BE(offset int, v int16)
- func (p Pointer) SetInt16LE(offset int, v int16)
- func (p Pointer) SetInt24(offset int, v int32)
- func (p Pointer) SetInt24BE(offset int, v int32)
- func (p Pointer) SetInt24LE(offset int, v int32)
- func (p Pointer) SetInt32(offset int, v int32)
- func (p Pointer) SetInt32BE(offset int, v int32)
- func (p Pointer) SetInt32LE(offset int, v int32)
- func (p Pointer) SetInt40(offset int, v int64)
- func (p Pointer) SetInt40BE(offset int, v int64)
- func (p Pointer) SetInt40LE(offset int, v int64)
- func (p Pointer) SetInt48(offset int, v int64)
- func (p Pointer) SetInt48BE(offset int, v int64)
- func (p Pointer) SetInt48LE(offset int, v int64)
- func (p Pointer) SetInt56(offset int, v int64)
- func (p Pointer) SetInt56BE(offset int, v int64)
- func (p Pointer) SetInt56LE(offset int, v int64)
- func (p Pointer) SetInt64(offset int, v int64)
- func (p Pointer) SetInt64BE(offset int, v int64)
- func (p Pointer) SetInt64LE(offset int, v int64)
- func (p Pointer) SetInt8(offset int, v int8)
- func (p Pointer) SetPointer(offset int, v Pointer)
- func (p Pointer) SetString(offset int, value string)
- func (p Pointer) SetUint(offset int, v uint)
- func (p Pointer) SetUint16(offset int, v uint16)
- func (p Pointer) SetUint16BE(offset int, v uint16)
- func (p Pointer) SetUint16LE(offset int, v uint16)
- func (p Pointer) SetUint24(offset int, v uint32)
- func (p Pointer) SetUint24BE(offset int, v uint32)
- func (p Pointer) SetUint24LE(offset int, v uint32)
- func (p Pointer) SetUint32(offset int, v uint32)
- func (p Pointer) SetUint32BE(offset int, v uint32)
- func (p Pointer) SetUint32LE(offset int, v uint32)
- func (p Pointer) SetUint40(offset int, v uint64)
- func (p Pointer) SetUint40BE(offset int, v uint64)
- func (p Pointer) SetUint40LE(offset int, v uint64)
- func (p Pointer) SetUint48(offset int, v uint64)
- func (p Pointer) SetUint48BE(offset int, v uint64)
- func (p Pointer) SetUint48LE(offset int, v uint64)
- func (p Pointer) SetUint56(offset int, v uint64)
- func (p Pointer) SetUint56BE(offset int, v uint64)
- func (p Pointer) SetUint56LE(offset int, v uint64)
- func (p Pointer) SetUint64(offset int, v uint64)
- func (p Pointer) SetUint64BE(offset int, v uint64)
- func (p Pointer) SetUint64LE(offset int, v uint64)
- func (p Pointer) SetUint8(offset int, v uint8)
- func (p Pointer) SetUintptr(offset int, v uintptr)
- func (p Pointer) SizeOf() uintptr
- func (p Pointer) String(offset, size int) string
- func (p Pointer) ToFat(length int) FatPointer
- func (p Pointer) Uint(offset int) uint
- func (p Pointer) Uint16(offset int) uint16
- func (p Pointer) Uint16BE(offset int) uint16
- func (p Pointer) Uint16LE(offset int) uint16
- func (p Pointer) Uint24(offset int) uint32
- func (p Pointer) Uint24BE(offset int) uint32
- func (p Pointer) Uint24LE(offset int) uint32
- func (p Pointer) Uint32(offset int) uint32
- func (p Pointer) Uint32BE(offset int) uint32
- func (p Pointer) Uint32BESlow() uint32
- func (p Pointer) Uint32LE(offset int) uint32
- func (p Pointer) Uint40(offset int) uint64
- func (p Pointer) Uint40BE(offset int) uint64
- func (p Pointer) Uint40LE(offset int) uint64
- func (p Pointer) Uint48(offset int) uint64
- func (p Pointer) Uint48BE(offset int) uint64
- func (p Pointer) Uint48LE(offset int) uint64
- func (p Pointer) Uint56(offset int) uint64
- func (p Pointer) Uint56BE(offset int) uint64
- func (p Pointer) Uint56LE(offset int) uint64
- func (p Pointer) Uint64(offset int) uint64
- func (p Pointer) Uint64BE(offset int) uint64
- func (p Pointer) Uint64LE(offset int) uint64
- func (p Pointer) Uint8(offset int) uint8
- func (p Pointer) Uintptr(offset int) uintptr
- func (p Pointer) Unsafe() unsafe.Pointer
- func (p Pointer) WyHash64(seed uint64, offset, length int) uint64
- func (p Pointer) Zero(size uintptr)
- type PointerSet
- func (ps *PointerSet) Add(key uintptr, depth int) (bool, bool)
- func (ps *PointerSet) Close() error
- func (ps *PointerSet) Delete(key uintptr) (uintptr, bool)
- func (ps *PointerSet) Grow() bool
- func (ps *PointerSet) Has(key uintptr) bool
- func (ps *PointerSet) Reset()
- func (ps *PointerSet) Set(key uintptr) (bool, bool)
Constants ¶
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 ¶
var (
ErrOutOfMemory = errors.New("out of memory")
)
Functions ¶
func FloorToPowerOfTwo ¶
FloorToPowerOfTwo returns the greatest power of two integer value less than or equal to n.
func IsPowerOfTwo ¶
IsPowerOfTwo reports whether given integer is a power of two.
func LogarithmicRange ¶
LogarithmicRange iterates from ceiled to power of two min to max, calling cb on each iteration.
func Move ¶
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 PrintGCStats ¶ added in v0.1.5
func PrintGCStats()
func Zero ¶
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 (AutoFree) AllocCap ¶
func (af AutoFree) AllocCap(size uintptr) FatPointer
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 BytesOfString ¶ added in v0.1.4
func (*Bytes) AppendByte ¶
func (*Bytes) AppendByteString ¶ added in v0.1.2
func (*Bytes) AppendBytes ¶
func (*Bytes) AppendFloat32 ¶
func (*Bytes) AppendFloat32BE ¶
func (*Bytes) AppendFloat32LE ¶
func (*Bytes) AppendFloat32String ¶ added in v0.1.3
func (*Bytes) AppendFloat64 ¶
func (*Bytes) AppendFloat64BE ¶
func (*Bytes) AppendFloat64LE ¶
func (*Bytes) AppendFloat64String ¶ added in v0.1.3
func (*Bytes) AppendInt16 ¶
func (*Bytes) AppendInt16BE ¶
func (*Bytes) AppendInt16LE ¶
func (*Bytes) AppendInt16String ¶ added in v0.1.2
func (*Bytes) AppendInt24 ¶
func (*Bytes) AppendInt24BE ¶
func (*Bytes) AppendInt24LE ¶
func (*Bytes) AppendInt32 ¶
func (*Bytes) AppendInt32BE ¶
func (*Bytes) AppendInt32LE ¶
func (*Bytes) AppendInt32String ¶ added in v0.1.2
func (*Bytes) AppendInt40 ¶
func (*Bytes) AppendInt40BE ¶
func (*Bytes) AppendInt40LE ¶
func (*Bytes) AppendInt48 ¶
func (*Bytes) AppendInt48BE ¶
func (*Bytes) AppendInt48LE ¶
func (*Bytes) AppendInt56 ¶
func (*Bytes) AppendInt56BE ¶
func (*Bytes) AppendInt56LE ¶
func (*Bytes) AppendInt64 ¶
func (*Bytes) AppendInt64BE ¶
func (*Bytes) AppendInt64LE ¶
func (*Bytes) AppendInt64String ¶ added in v0.1.2
func (*Bytes) AppendInt8 ¶
func (*Bytes) AppendInt8String ¶ added in v0.1.2
func (*Bytes) AppendIntString ¶ added in v0.1.2
func (*Bytes) AppendPointer ¶
func (*Bytes) AppendString ¶
func (*Bytes) AppendUint ¶ added in v0.1.6
func (*Bytes) AppendUint16 ¶ added in v0.1.6
func (*Bytes) AppendUint16BE ¶ added in v0.1.6
func (*Bytes) AppendUint16LE ¶ added in v0.1.6
func (*Bytes) AppendUint16String ¶ added in v0.1.6
func (*Bytes) AppendUint24 ¶ added in v0.1.6
func (*Bytes) AppendUint24BE ¶ added in v0.1.6
func (*Bytes) AppendUint24LE ¶ added in v0.1.6
func (*Bytes) AppendUint32 ¶ added in v0.1.6
func (*Bytes) AppendUint32BE ¶ added in v0.1.6
func (*Bytes) AppendUint32LE ¶ added in v0.1.6
func (*Bytes) AppendUint32String ¶ added in v0.1.6
func (*Bytes) AppendUint40 ¶ added in v0.1.6
func (*Bytes) AppendUint40BE ¶ added in v0.1.6
func (*Bytes) AppendUint40LE ¶ added in v0.1.6
func (*Bytes) AppendUint48 ¶ added in v0.1.6
func (*Bytes) AppendUint48BE ¶ added in v0.1.6
func (*Bytes) AppendUint48LE ¶ added in v0.1.6
func (*Bytes) AppendUint56 ¶ added in v0.1.6
func (*Bytes) AppendUint56BE ¶ added in v0.1.6
func (*Bytes) AppendUint56LE ¶ added in v0.1.6
func (*Bytes) AppendUint64 ¶ added in v0.1.6
func (*Bytes) AppendUint64BE ¶ added in v0.1.6
func (*Bytes) AppendUint64LE ¶ added in v0.1.6
func (*Bytes) AppendUint64String ¶ added in v0.1.6
func (*Bytes) AppendUint8 ¶ added in v0.1.6
func (*Bytes) AppendUint8String ¶ added in v0.1.6
func (*Bytes) AppendUintString ¶ added in v0.1.6
func (*Bytes) AppendUintptr ¶
func (*Bytes) CheckBounds ¶
func (*Bytes) EnsureLen ¶
EnsureLen ensures the length is at least neededLen in size If not, EnsureCap(neededLen) is called and the length set to neededLen.
func (*Bytes) Reset ¶
func (s *Bytes) Reset()
Reset zeroes out the entire allocation and sets the length back to 0
func (*Bytes) SetFloat32 ¶
func (*Bytes) SetFloat32BE ¶
func (*Bytes) SetFloat32LE ¶
func (*Bytes) SetFloat64 ¶
func (*Bytes) SetFloat64BE ¶
func (*Bytes) SetFloat64LE ¶
func (*Bytes) SetInt16BE ¶
func (*Bytes) SetInt16LE ¶
func (*Bytes) SetInt24BE ¶
func (*Bytes) SetInt24LE ¶
func (*Bytes) SetInt32BE ¶
func (*Bytes) SetInt32LE ¶
func (*Bytes) SetInt40BE ¶
func (*Bytes) SetInt40LE ¶
func (*Bytes) SetInt48BE ¶
func (*Bytes) SetInt48LE ¶
func (*Bytes) SetInt56BE ¶
func (*Bytes) SetInt56LE ¶
func (*Bytes) SetInt64BE ¶
func (*Bytes) SetInt64LE ¶
func (*Bytes) SetPointer ¶
func (*Bytes) SetUint16BE ¶ added in v0.1.6
func (*Bytes) SetUint16LE ¶ added in v0.1.6
func (*Bytes) SetUint24BE ¶ added in v0.1.6
func (*Bytes) SetUint24LE ¶ added in v0.1.6
func (*Bytes) SetUint32BE ¶ added in v0.1.6
func (*Bytes) SetUint32LE ¶ added in v0.1.6
func (*Bytes) SetUint40BE ¶ added in v0.1.6
func (*Bytes) SetUint40LE ¶ added in v0.1.6
func (*Bytes) SetUint48BE ¶ added in v0.1.6
func (*Bytes) SetUint48LE ¶ added in v0.1.6
func (*Bytes) SetUint56BE ¶ added in v0.1.6
func (*Bytes) SetUint56LE ¶ added in v0.1.6
func (*Bytes) SetUint64BE ¶ added in v0.1.6
func (*Bytes) SetUint64LE ¶ added in v0.1.6
func (*Bytes) SetUintptr ¶
type FatPointer ¶
type FatPointer struct { Pointer // contains filtered or unexported fields }
func FatPointerOf ¶
func FatPointerOf(p Pointer, length uintptr) FatPointer
func FatPointerOfBool ¶ added in v0.1.4
func FatPointerOfBool(v *bool) FatPointer
func FatPointerOfBytes ¶ added in v0.1.4
func FatPointerOfBytes(v []byte) FatPointer
func FatPointerOfBytesRef ¶ added in v0.1.4
func FatPointerOfBytesRef(v *[]byte) FatPointer
func FatPointerOfFloat32 ¶ added in v0.1.4
func FatPointerOfFloat32(v *float32) FatPointer
func FatPointerOfFloat64 ¶ added in v0.1.4
func FatPointerOfFloat64(v *float64) FatPointer
func FatPointerOfInt16 ¶ added in v0.1.4
func FatPointerOfInt16(v *int16) FatPointer
func FatPointerOfInt32 ¶ added in v0.1.4
func FatPointerOfInt32(v *int32) FatPointer
func FatPointerOfInt64 ¶ added in v0.1.4
func FatPointerOfInt64(v *int64) FatPointer
func FatPointerOfInt8 ¶ added in v0.1.4
func FatPointerOfInt8(v *int8) FatPointer
func FatPointerOfString ¶ added in v0.1.4
func FatPointerOfString(s string) FatPointer
func FatPointerOfStringRef ¶ added in v0.1.4
func FatPointerOfStringRef(s *string) FatPointer
func FatPointerOfUInt16 ¶ added in v0.1.4
func FatPointerOfUInt16(v *uint16) FatPointer
func FatPointerOfUInt32 ¶ added in v0.1.4
func FatPointerOfUInt32(v *uint32) FatPointer
func FatPointerOfUInt64 ¶ added in v0.1.4
func FatPointerOfUInt64(v *uint64) FatPointer
func FatPointerOfUInt8 ¶ added in v0.1.4
func FatPointerOfUInt8(v *uint8) 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 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 ¶
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 AllocZeroed ¶
func AllocZeroedCap ¶
func PointerOfString ¶ added in v0.1.4
func (Pointer) AsFloat32BE ¶ added in v0.1.4
func (Pointer) AsFloat32LE ¶ added in v0.1.4
func (Pointer) AsFloat64BE ¶ added in v0.1.4
func (Pointer) AsFloat64LE ¶ added in v0.1.4
func (Pointer) AsUint16BE ¶ added in v0.1.5
func (Pointer) AsUint16LE ¶ added in v0.1.5
func (Pointer) AsUint32BE ¶ added in v0.1.5
func (Pointer) AsUint32LE ¶ added in v0.1.5
func (Pointer) AsUint64BE ¶ added in v0.1.5
func (Pointer) AsUint64LE ¶ added in v0.1.5
func (Pointer) Clone ¶
Clone the memory starting at offset for size number of bytes and return the new Pointer.
func (Pointer) SetFloat32 ¶
func (Pointer) SetFloat32BE ¶
func (Pointer) SetFloat32LE ¶
func (Pointer) SetFloat64 ¶
func (Pointer) SetFloat64BE ¶
func (Pointer) SetFloat64LE ¶
func (Pointer) SetInt16BE ¶
func (Pointer) SetInt16LE ¶
func (Pointer) SetInt24BE ¶
func (Pointer) SetInt24LE ¶
func (Pointer) SetInt32BE ¶
func (Pointer) SetInt32LE ¶
func (Pointer) SetInt40BE ¶
func (Pointer) SetInt40LE ¶
func (Pointer) SetInt48BE ¶
func (Pointer) SetInt48LE ¶
func (Pointer) SetInt56BE ¶
func (Pointer) SetInt56LE ¶
func (Pointer) SetInt64BE ¶
func (Pointer) SetInt64LE ¶
func (Pointer) SetPointer ¶
func (Pointer) SetUint16BE ¶ added in v0.1.5
func (Pointer) SetUint16LE ¶ added in v0.1.5
func (Pointer) SetUint24BE ¶ added in v0.1.5
func (Pointer) SetUint24LE ¶ added in v0.1.5
func (Pointer) SetUint32BE ¶ added in v0.1.5
func (Pointer) SetUint32LE ¶ added in v0.1.5
func (Pointer) SetUint40BE ¶ added in v0.1.5
func (Pointer) SetUint40LE ¶ added in v0.1.5
func (Pointer) SetUint48BE ¶ added in v0.1.5
func (Pointer) SetUint48LE ¶ added in v0.1.5
func (Pointer) SetUint56BE ¶ added in v0.1.5
func (Pointer) SetUint56LE ¶ added in v0.1.5
func (Pointer) SetUint64BE ¶ added in v0.1.5
func (Pointer) SetUint64LE ¶ added in v0.1.5
func (Pointer) SetUintptr ¶
func (Pointer) SizeOf ¶
Sizeof returns the size of the allocation provided by the platform allocator.
func (Pointer) ToFat ¶
func (p Pointer) ToFat(length int) FatPointer
func (Pointer) Uint32BESlow ¶ added in v0.1.5
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.
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
alloc
|
|
rpmalloc/lib
See https://github.com/golang/go/issues/26366.
|
See https://github.com/golang/go/issues/26366. |
rpmalloc/lib/darwin_amd64
See https://github.com/golang/go/issues/26366.
|
See https://github.com/golang/go/issues/26366. |
rpmalloc/lib/darwin_arm64
See https://github.com/golang/go/issues/26366.
|
See https://github.com/golang/go/issues/26366. |
rpmalloc/lib/linux_amd64
See https://github.com/golang/go/issues/26366.
|
See https://github.com/golang/go/issues/26366. |
collections
|
|
net
|
|