package module
v0.2.0 Latest Latest

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

Go to latest
Published: Nov 16, 2023 License: Apache-2.0 Imports: 6 Imported by: 6



Cirrus CI GoDoc Go Report Card

This package provides a cross-platform wrapper over some common memory-related system calls.

Please report any issues that you experience.




View Source
const ErrInvalidFlag = "<memcall> memory protection flag is undefined"

ErrInvalidFlag indicates that a given memory protection flag is undefined.


This section is empty.


func Alloc

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

Alloc allocates a byte slice of length n and returns it.

func DisableCoreDumps

func DisableCoreDumps() error

DisableCoreDumps disables core dumps on Unix systems.

func Free

func Free(b []byte) error

Free deallocates the byte slice specified.

func Lock

func Lock(b []byte) error

Lock is a wrapper for mlock(2), with extra precautions.

func Protect

func Protect(b []byte, mpf MemoryProtectionFlag) error

Protect modifies the protection state for a specified byte slice.

func Unlock

func Unlock(b []byte) error

Unlock is a wrapper for munlock(2).


type MemoryProtectionFlag

type MemoryProtectionFlag struct {
	// contains filtered or unexported fields

MemoryProtectionFlag specifies some particular memory protection flag.

func NoAccess

func NoAccess() MemoryProtectionFlag

NoAccess specifies that the memory should be marked unreadable and immutable.

func ReadOnly

func ReadOnly() MemoryProtectionFlag

ReadOnly specifies that the memory should be marked read-only (immutable).

func ReadWrite

func ReadWrite() MemoryProtectionFlag

ReadWrite specifies that the memory should be made readable and writable.

Jump to

Keyboard shortcuts

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