arena

Imports

Imports #

"internal/reflectlite"
"unsafe"

Structs

Arena struct #

Arena represents a collection of Go values allocated and freed together. Arenas are useful for improving efficiency as they may be freed back to the runtime manually, though any memory obtained from freed arenas must not be accessed once that happens. An Arena is automatically freed once it is no longer referenced, so it must be kept alive (see runtime.KeepAlive) until any memory allocated from it is no longer needed. An Arena must never be used concurrently by multiple goroutines.

type Arena struct {
a unsafe.Pointer
}

Functions

Clone function #

Clone makes a shallow copy of the input value that is no longer bound to any arena it may have been allocated from, returning the copy. If it was not allocated from an arena, it is returned untouched. This function is useful to more easily let an arena-allocated value out-live its arena. T must be a pointer, a slice, or a string, otherwise this function will panic.

func Clone(s T) T

Free method #

Free frees the arena (and all objects allocated from the arena) so that memory backing the arena can be reused fairly quickly without garbage collection overhead. Applications must not call any method on this arena after it has been freed.

func (a *Arena) Free()

MakeSlice function #

MakeSlice creates a new []T with the provided capacity and length. The []T must not be used after the arena is freed. Accessing the underlying storage of the slice after free may result in a fault, but this fault is also not guaranteed.

func MakeSlice(a *Arena, len int, cap int) []T

New function #

New creates a new *T in the provided arena. The *T must not be used after the arena is freed. Accessing the value after free may result in a fault, but this fault is also not guaranteed.

func New(a *Arena) *T

NewArena function #

NewArena allocates a new arena.

func NewArena() *Arena

reflect_arena_New function #

go:linkname reflect_arena_New reflect.arena_New

func reflect_arena_New(a *Arena, typ any) any

runtime_arena_arena_Free function #

go:linkname runtime_arena_arena_Free

func runtime_arena_arena_Free(arena unsafe.Pointer)

runtime_arena_arena_New function #

go:linkname runtime_arena_arena_New

func runtime_arena_arena_New(arena unsafe.Pointer, typ any) any

runtime_arena_arena_Slice function #

Mark as noescape to avoid escaping the slice header. go:noescape go:linkname runtime_arena_arena_Slice

func runtime_arena_arena_Slice(arena unsafe.Pointer, slice any, cap int)

runtime_arena_heapify function #

go:linkname runtime_arena_heapify

func runtime_arena_heapify(any) any

runtime_arena_newArena function #

go:linkname runtime_arena_newArena

func runtime_arena_newArena() unsafe.Pointer

Generated with Arrow