memory

package
v1.87.11-cluster Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2023 License: Apache-2.0 Imports: 8 Imported by: 23

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Allowed

func Allowed() int

Allowed returns the amount of system memory allowed to use by the app.

The function must be called only after flag.Parse is called.

func Remaining added in v1.27.0

func Remaining() int

Remaining returns the amount of memory remaining to the OS.

This function must be called only after flag.Parse is called.

Types

type Limiter

type Limiter struct {
	// The maximum allowed memory
	MaxSize uint64
	// contains filtered or unexported fields
}

Limiter is the memory limiter.

It limits memory to MaxSize.

func (*Limiter) Get

func (ml *Limiter) Get(n uint64) bool

Get obtains n bytes of memory from ml.

It returns true on success, false on error.

func (*Limiter) Put

func (ml *Limiter) Put(n uint64)

Put returns back n bytes of memory to ml.

Jump to

Keyboard shortcuts

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