Documentation
¶
Overview ¶
Package meminfo reads how much memory this process may still use, for code that sizes its concurrency to the machine rather than to a fixed count.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Info ¶
type Info struct {
// Total is the machine's physical memory.
Total uint64
// Available is the kernel's estimate of what can still be allocated
// without pushing the system into swap. Unlike free memory it accounts for
// reclaimable caches, and it falls as this process's heap grows — which is
// what makes it usable as a feedback signal for admitting more workers.
Available uint64
}
Info is a snapshot of the machine's memory, in bytes.
func Read ¶
Read reports the memory this process may use, from /proc/meminfo narrowed by the memory limits of its cgroup and of every cgroup above it. It returns false if either figure is missing from /proc/meminfo, or if memory is under a cgroup v1 controller: its limits are not read here, and the host figures can sit far beyond them.
Click to show internal directories.
Click to hide internal directories.