memory

package
v3.1.1 Latest Latest
Warning

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

Go to latest
Published: Jun 22, 2025 License: BSD-3-Clause Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var PageNoMemoryErr = unix.ENOMEM

Functions

func Allocate

func Allocate[T any](a Allocator) (*T, error)

func AllocateSlice

func AllocateSlice[T any, T2 ~int | ~uint64 | ~uint32](a Allocator, size T2) ([]T, error)

func Free

func Free[T any](a Allocator, v *T) error

func FreeSlice

func FreeSlice[T any](a Allocator, v []T) error

func PageReadExecute

func PageReadExecute(memory []byte) error

func PageReadWrite

func PageReadWrite(memory []byte) error

func PageReadWriteExecute

func PageReadWriteExecute(memory []byte) error

PageReadWriteExecute Insecure!

Types

type AlignedAllocator

type AlignedAllocator uint64

func (AlignedAllocator) AllocMemory

func (a AlignedAllocator) AllocMemory(size uint64) ([]byte, error)

func (AlignedAllocator) FreeMemory

func (a AlignedAllocator) FreeMemory(memory []byte) error

type Allocator

type Allocator interface {
	AllocMemory(size uint64) ([]byte, error)
	FreeMemory(memory []byte) error
}

func NewAlignedAllocator

func NewAlignedAllocator(alignment uint64) Allocator

func NewLargePageAllocator

func NewLargePageAllocator() Allocator

func NewPageAllocator

func NewPageAllocator() Allocator

type LargePageAllocator

type LargePageAllocator struct {
}

func (LargePageAllocator) AllocMemory

func (a LargePageAllocator) AllocMemory(size uint64) ([]byte, error)

func (LargePageAllocator) FreeMemory

func (a LargePageAllocator) FreeMemory(memory []byte) error

type PageAllocator

type PageAllocator struct {
}

func (PageAllocator) AllocMemory

func (a PageAllocator) AllocMemory(size uint64) ([]byte, error)

func (PageAllocator) FreeMemory

func (a PageAllocator) FreeMemory(memory []byte) error

Jump to

Keyboard shortcuts

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