我有一个进程在“top”中报告它分配了 6GB 的常驻内存和 70GB 的虚拟内存。奇怪的是,这个特定的服务器只有 8GB 的物理空间和 35GB 的可用交换空间。
从“顶级”手册:
o: VIRT -- Virtual Image (kb)
The total amount of virtual memory used by the task. It includes
all code, data and shared libraries plus pages that have been
swapped out. (Note: you can define the STATSIZE=1 environment vari-
able and the VIRT will be calculated from the /proc/#/state VmSize
field.)
VIRT = SWAP + RES.
Run Code Online (Sandbox Code Playgroud)
鉴于这种解释,我希望进程的虚拟内存分配仅限于我的交换 + 可用物理内存。
根据'pmap',这个进程的代码、共享库和共享内存部分都是最小的——不超过300M左右。
显然,机器和过程仍然正常运行(虽然很慢),那么我在这里错过了什么?