mmap

package
v1.52.3-0...-16af9ab Latest Latest
Warning

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

Go to latest
Published: Jun 26, 2020 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var PageSize = os.Getpagesize()

PageSize is the minimum allocation size. Allocations will use at least this size and are likely to be multiplied up to a multiple of this size.

Functions

func Alloc

func Alloc(size int) ([]byte, error)

Alloc allocates size bytes and returns a slice containing them. If the allocation fails it will return with an error. This is best used for allocations which are a multiple of the PageSize.

func Free

func Free(mem []byte) error

Free frees buffers allocated by Alloc. Note it should be passed the same slice (not a derived slice) that Alloc returned. If the free fails it will return with an error.

func MustAlloc

func MustAlloc(size int) []byte

MustAlloc allocates size bytes and returns a slice containing them. If the allocation fails it will panic. This is best used for allocations which are a multiple of the PageSize.

func MustFree

func MustFree(mem []byte)

MustFree frees buffers allocated by Alloc. Note it should be passed the same slice (not a derived slice) that Alloc returned. If the free fails it will panic.

Types

This section is empty.

Jump to

Keyboard shortcuts

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