Documentation
¶
Overview ¶
Package memlimit sets the Go runtime's soft memory limit from the container's memory limit, for the operator and the engine.
Index ¶
Constants ¶
const Env = "MEMORY_LIMIT"
Env has the container's memory limit in bytes: the chart (operator) and the injected engine set it from the downward API (resourceFieldRef limits.memory). Without a limit, Kubernetes gives the node's allocatable memory.
Variables ¶
This section is empty.
Functions ¶
func Detect ¶ added in v0.6.0
Detect returns Limit and where the container's limit came from: Env, or without it (a plain container: docker run --memory), the file of the process's cgroup that has it, cgroup v2's memory.max or v1's memory.limit_in_bytes, read from root (nil: no cgroup is read). "" when there is no limit.
func Limit ¶
Limit returns the Go runtime's soft memory limit: 90% of the container's memory limit, the rest left for what the runtime doesn't manage. 0 when GOMEMLIMIT is set (the runtime applied it) or no limit is known.
The heap goal is otherwise twice the live heap at the last GC, so the RSS of a busy process reaches the container limit long before its live heap does (0004 §8). With a limit, the GC runs more often near it.
Types ¶
This section is empty.