memory

package
v0.38.0 Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2019 License: MIT Imports: 4 Imported by: 26

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Allocator

type Allocator struct {
	// Limit is the limit on the amount of memory that this allocator
	// can assign. If this is null, there is no limit.
	Limit *int64
	// contains filtered or unexported fields
}

Allocator tracks the amount of memory being consumed by a query.

func (*Allocator) Allocate

func (a *Allocator) Allocate(size int) error

Allocate will ensure that the requested memory is available and record that it is in use.

func (*Allocator) Allocated

func (a *Allocator) Allocated() int64

Allocated returns the amount of currently allocated memory.

func (*Allocator) Free

func (a *Allocator) Free(size int)

Free will reduce the amount of memory used by this Allocator. In general, memory should be freed using the Reference returned by Allocate. Not all code is capable of using this though so this method provides a low-level way of releasing the memory without using a Reference.

func (*Allocator) MaxAllocated

func (a *Allocator) MaxAllocated() int64

MaxAllocated reports the maximum amount of allocated memory at any point in the query.

type LimitExceededError

type LimitExceededError struct {
	Limit     int64
	Allocated int64
	Wanted    int64
}

LimitExceededError is an error when the allocation limit is exceeded.

func (LimitExceededError) Error

func (a LimitExceededError) Error() string

Jump to

Keyboard shortcuts

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