Documentation
¶
Overview ¶
Package sysmem answers two questions about memory: how much this process was given, and how much of it the Go runtime is holding.
"Given" is the container's limit when there is one (cgroup v2 memory.max, cgroup v1 memory.limit_in_bytes) and the machine's RAM otherwise: a filex in a container with 4 GiB on a 64 GiB host was given 4 GiB, and that is the figure a budget has to be a share of. The search index takes its memory budget from here (issue #115).
Index ¶
Constants ¶
const ( SourceCgroupV2 = "cgroup v2 memory.max" SourceCgroupV1 = "cgroup v1 memory.limit_in_bytes" SourceHost = "host memory" SourceUnknown = "unknown" )
Sources, as Budget.Source names them in the log.
Variables ¶
This section is empty.
Functions ¶
func InUse ¶
func InUse() uint64
InUse is the memory the Go runtime holds and has not handed back to the operating system: every heap span, stack and runtime structure. It leaves out memory-mapped files (the search index's segments), whose pages are the kernel's to drop under pressure and are not this process's to ration.
Types ¶
type Budget ¶
Budget is the memory this process was given and where the figure came from. Bytes is 0 when nothing could be read.