Documentation
¶
Overview ¶
Package memlimit reports the memory budget the process actually has, so a size derived from it (the merge cap) tracks the container it runs in rather than a constant that is right at exactly one deployment size.
It is deliberately dependency-free: the answer comes from GOMEMLIMIT, the cgroup, or the host's total memory, in that order of authority.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Bytes ¶
func Bytes() int64
Bytes returns the memory the process may use, or 0 when nothing reports one.
GOMEMLIMIT wins when set: it is what the embedder promised the Go heap, and an embedder that applies a cgroup limit to it (automemlimit and friends) has already reserved its own headroom. Otherwise the cgroup limit is used, since a container's limit — not the host's RAM — is what the kernel kills against, and the host total is the last resort.
func MergeShare ¶
MergeShare is how many bytes one merge may hold: the total merge allowance divided across the merges that may run at once and by amplification, the peak resident per byte of the bound (a merge that holds its output twice over passes 2).
configured is the caller's total allowance: 0 takes a share of the detected process budget (Bytes), and a negative value opts out, returning math.MaxInt64 so the caller's other bounds decide alone.
Types ¶
This section is empty.