Documentation
¶
Index ¶
- func Clone[T any](alloc M, x T) T
- func Make[E any](alloc M, len, cap int) []E
- func MakeTyped(alloc M, et *abi.Type, len, cap int) unsafe.Pointer
- func New[T any](alloc M) *T
- func SizeOutOfRange(typSz uintptr, n int) (outOfRange bool)
- func ZeroSized() unsafe.Pointer
- type A
- type Arena
- type DenyNoneZero
- type H
- type Hint
- type M
- type P
- type S
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SizeOutOfRange ¶
Types ¶
type Arena ¶
type Arena interface {
M
// Discard this arena, all allocated data will be gone.
Discard()
}
Arena defines the arena interface.
type DenyNoneZero ¶
type DenyNoneZero struct{}
DenyNoneZero implements M that only allows allocation of zero sized types.
type M ¶
type M interface {
// Malloc allocates memory for n elements of typ.
//
// NOTE: for bytes allocations, typ may be nil.
Malloc(typ *abi.Type, n uintptr, zeroize bool) unsafe.Pointer
// Free memory allocated for n elements.
//
// NOTE: for freeing types without heap pointer, typ may be nil
// and in that case, n is the bytes allocated.
Free(typ *abi.Type, n uintptr, ptr unsafe.Pointer) Hint
}
M for general purpose allocations.
Click to show internal directories.
Click to hide internal directories.