Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Allocator ¶
type Allocator[P Ptr[P]] interface { // Alloc allocates a new object and returns its pointer. Alloc() P // Free the ptr allocated by Alloc(). Free(ptr P) // Reset retains underlaying storage of allocated objects but clears out // all existing data. Reset() }
Allocator defines required methods for an allocator implementation.
type BumpAlloc ¶
type BumpAlloc[T any] struct { // contains filtered or unexported fields }
BumpAlloc manages the allocation of type T
func NewBumpAlloc ¶
type NativeAlloc ¶
type NativeAlloc[T any] struct{}
NativeAlloc allocates new objects with golang built-in new(T).
func NewNativeAlloc ¶
func NewNativeAlloc[T any]() (alloc NativeAlloc[T])
func (NativeAlloc[T]) Alloc ¶
func (NativeAlloc[T]) Alloc() UnsafePtr
func (NativeAlloc[T]) Free ¶
func (NativeAlloc[T]) Free(p UnsafePtr)
func (NativeAlloc[T]) Reset ¶
func (NativeAlloc[T]) Reset()
type PoolAlloc ¶
type PoolAlloc[T any] struct { // contains filtered or unexported fields }
func NewPoolAllocator ¶
type Ptr ¶
type Ptr[Self any] interface { // IsNull returns true when the pointer points to nowhere. // // Implementations MUST return true for zero value. IsNull() bool // Load returns an in-memory address as the handle of the pointed object. Load() unsafe.Pointer // Equals returns true if the two pointer points to the same target. Equals(other Self) bool }
Ptr defines required methods for pointers.
type SizedAlloc ¶
type SizedAlloc uintptr
SizedAlloc is make([]byte, SizedAlloc).
NOTE: zero-size data types will use nil pointer.
func NewSizedAlloc ¶
func NewSizedAlloc(size uintptr) SizedAlloc
func (SizedAlloc) Alloc ¶
func (a SizedAlloc) Alloc() UnsafePtr
func (SizedAlloc) Free ¶
func (SizedAlloc) Free(p UnsafePtr)
func (SizedAlloc) Reset ¶
func (SizedAlloc) Reset()
Click to show internal directories.
Click to hide internal directories.