Documentation
¶
Overview ¶
Package memory coordinates process-wide cache trimming and pressure sweeps without replacing Go's runtime garbage collection policy or setting GOMEMLIMIT.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Governor ¶
type Governor struct {
// contains filtered or unexported fields
}
Governor tracks process-wide reclaimable caches and coordinates periodic idle sweeps alongside heap-pressure trimming.
func NewGovernor ¶
func NewGovernor() *Governor
NewGovernor constructs an isolated Governor. Tests use dedicated instances to exercise registration and pressure triggers without disturbing Default.
func (*Governor) CheckPressure ¶
CheckPressure samples Go heap object and live-heap metrics and runs Trim(Pressure) when retained memory crosses its high-water mark.
func (*Governor) Register ¶
Register adds a trim callback to the Governor and returns an idempotent unregister function. Callbacks run without holding the Governor lock.