manual

package
v2.0.8 Latest Latest
Warning

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

Go to latest
Published: May 5, 2026 License: BSD-3-Clause Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// MaxArrayLen is a safe maximum length for slices on this architecture.
	MaxArrayLen = 1<<50 - 1
)

Variables

This section is empty.

Functions

func Free

func Free(purpose Purpose, b []byte)

Free frees the specified slice. It has to be exactly the slice that was returned by New.

func New

func New(purpose Purpose, n int) []byte

New allocates a slice of size n. The returned slice is from manually managed memory and MUST be released by calling Free. Failure to do so will result in a memory leak.

Types

type Metrics

type Metrics [NumPurposes]struct {
	// InUseBytes is the total number of bytes currently allocated. This is just
	// the sum of the lengths of the allocations and does not include any overhead
	// or fragmentation.
	InUseBytes uint64
}

Metrics contains memory statistics by purpose.

func GetMetrics

func GetMetrics() Metrics

GetMetrics returns manual memory usage statistics.

type Purpose

type Purpose uint8

Purpose identifies the use-case for an allocation.

const (
	BlockCacheMap Purpose
	BlockCacheEntry
	BlockCacheData
	MemTable

	NumPurposes
)

Jump to

Keyboard shortcuts

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