vm.memory.size[used] 和 vm.memory.size[available] 的和不是必需等于总内存。 例如, 在FreeBSD中 active, inactive, wired, cached被认为是使用的内存, 因为他们存储一些有用的信息。
同样,inactive, cached, free 也被认为是可用内存, 因为这些内存可以立即被分配给需要更多内存的线程。
所以不活动的内存是同时可以是使用和可用的。 正因为如此, item vm.memory.size[used] 只用来获得信息, 监控项 vm.memory.size[available] 在触发器中使用。
参看本页底部 "另外见" 部分关于在不同的操作系统中内存计算的更多详细信息。
This section provides more details and platform-specific information on the parameters of the vm.memory.size[<mode>]
agent item.
The following parameters are possible for this item:
Platform-specific calculation of available and used:
Platform | "available" | "used" |
---|---|---|
AIX | free + cached | real memory in use |
FreeBSD | inactive + cached + free | active + wired + cached |
HP UX | free | total - free |
Linux<3.14 | free + buffers | total - free |
Linux 3.14+ | /proc/meminfo, "Cached":+"MemAvailable:" | total - free |
NetBSD | inactive + execpages + file + free | total - free |
OpenBSD | inactive + free + cached | active + wired |
OSX | inactive + free | active + wired |
Solaris | free | total - free |
Win32 | free | total - free |
The sum of vm.memory.size[used] and vm.memory.size[available] does not necessarily equal total. For instance, on FreeBSD:
* Active, inactive, wired, cached memories are considered used, because they store some useful information.
* At the same time inactive, cached, free memories are considered available, because these kinds of memories can be given instantly to processes that request more memory.
So inactive memory is both used and available simultaneously. Because of this, the vm.memory.size[used] item is designed for informational purposes only, while vm.memory.size[available] is designed to be used in triggers.
See the "See also" section at the bottom of this page to find more detailed information about memory calculation in different OS.