memory

package
v0.48.0 Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2019 License: MIT Imports: 5 Imported by: 26

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultAllocator = memory.DefaultAllocator

DefaultAllocator is the default memory allocator for Flux.

This implements the memory.Allocator interface from arrow.

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

	// Allocator is the underlying memory allocator used to
	// allocate and free memory.
	// If this is unset, the DefaultAllocator is used.
	Allocator memory.Allocator
	// contains filtered or unexported fields
}

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

func (*Allocator) Account added in v0.48.0

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

Account will manually account for the amount of memory being used. This is typically used for memory that is allocated outside of the Allocator that must be recorded in some way.

func (*Allocator) Allocate

func (a *Allocator) Allocate(size int) []byte

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(b []byte)

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. Free will release the memory associated with the byte slice.

func (*Allocator) MaxAllocated

func (a *Allocator) MaxAllocated() int64

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

func (*Allocator) Reallocate added in v0.48.0

func (a *Allocator) Reallocate(size int, b []byte) []byte

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