mmap

package
v0.0.0-...-b4aeae5 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package mmap provides memory mapped related utilities.

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