memlimit

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2026 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Overview

Package memlimit sets the Go runtime's soft memory limit from the container's memory limit.

Without a limit the garbage collector only runs when the heap doubles, so a process holding a large live heap, such as a big metadata document being rewritten, can grow past a container limit and be OOM-killed while most of that memory is garbage. A soft limit just below the container's makes the collector work harder as it gets close instead.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Apply

func Apply(logger *slog.Logger)

Apply sets the runtime memory limit to ratio of the cgroup memory limit, unless GOMEMLIMIT is set, which the runtime has applied already, or no limit can be found. It only looks for one on Linux.

Types

This section is empty.

Jump to

Keyboard shortcuts

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