memory

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2025 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckMemoryLimit

func CheckMemoryLimit(limitMB int64) error

CheckMemoryLimit returns an error if memory usage exceeds the limit

Types

type MemoryError

type MemoryError struct {
	CurrentMB float64
	LimitMB   float64
	Message   string
}

MemoryError represents a memory limit error

func (*MemoryError) Error

func (e *MemoryError) Error() string

type MemoryMonitor

type MemoryMonitor struct {
	// contains filtered or unexported fields
}

MemoryMonitor provides memory monitoring capabilities

func NewMemoryMonitor

func NewMemoryMonitor(limitMB int64) *MemoryMonitor

NewMemoryMonitor creates a new memory monitor with the specified limit in MB

func (*MemoryMonitor) GetMemoryLimit

func (mm *MemoryMonitor) GetMemoryLimit() int64

GetMemoryLimit returns the configured memory limit in MB

func (*MemoryMonitor) GetMemoryUsage

func (mm *MemoryMonitor) GetMemoryUsage() float64

GetMemoryUsage returns current memory usage in MB

func (*MemoryMonitor) IsWithinLimit

func (mm *MemoryMonitor) IsWithinLimit() bool

IsWithinLimit checks if current memory usage is within the configured limit

func (*MemoryMonitor) SetLimit

func (mm *MemoryMonitor) SetLimit(limitMB int64)

SetLimit updates the memory limit in MB

func (*MemoryMonitor) Start

func (mm *MemoryMonitor) Start()

Start begins monitoring memory usage

func (*MemoryMonitor) Stop

func (mm *MemoryMonitor) Stop()

Stop stops monitoring memory usage

Jump to

Keyboard shortcuts

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