Solved: VMware Fusion 7 and VMware Tools - Memory Leak in ... - VMware Technology Network VMTN
-
如果你在主机上运行了很多 VMs (or 其他程序),并且 VMware Fusion 检测到存在内存压力,它就会使用guest上的"balloon" driver (vmw_balloon) 来从guest OS 偷取一些内存。这些“偷取”的内存在guest上表现为non-cache kernel dynamic memory。 运行 "
sudo rmmod vmw_balloon
" 可以释放 ballooned memory 还给 guest OS。注意,balloon driver 通常会提升guest 和 hosts 的性能,虽然guest上的"used memory"看起来很吓人 -- 该 "used memory" 只是一个统计口径,使用它来重新调配host 和 guest 的内存优先级。它不是传统意义上的被使用。 -
最新的虚拟硬件版本会分配non-cache kernel dynamic memory给 SVGA 和 3D features (display RAM, texture RAM, etc.)。关闭3D图形加速,or减少共享图像内存可以解决这个问题(Virtual Machine > Settings... > Display)。降级到更早的虚拟硬件版本(Virtual Machine > Settings... > Compatibility),也可以。
实践
原状
[root@prod-proxy ~]# free -h
total used free shared buff/cache available
Mem: 3.7G 3.0G 277M 114M 433M 350M
Swap: 3.9G 257M 3.6G
[root@prod-proxy ~]# smem -twp
Area Used Cache Noncache
firmware/hardware 0.00% 0.00% 0.00%
kernel image 0.00% 0.00% 0.00%
kernel dynamic memory 78.24% 9.73% 68.50%
userspace memory 14.52% 1.02% 13.50%
free memory 7.24% 7.24% 0.00%
----------------------------------------------------------
100.00% 18.00% 82.00%
[root@prod-proxy ~]#
[root@prod-proxy ~]# smem -tw
Area Used Cache Noncache
firmware/hardware 0 0 0
kernel image 0 0 0
kernel dynamic memory 3036812 377844 2658968
userspace memory 563808 39740 524068
free memory 281448 281448 0
----------------------------------------------------------
3882068 699032 3183036
查看是否加载balloon模块
[root@prod-proxy ~]# lsmod |grep balloon
vmw_balloon 18190 0
去除balloon模块,释放内存
[root@prod-proxy ~]# rmmod vmw_balloon
[root@prod-proxy ~]# lsmod |grep vmw
vmw_vsock_vmci_transport 30577 1
vsock 35327 2 vmw_vsock_vmci_transport
vmw_vmci 67013 1 vmw_vsock_vmci_transport
vmwgfx 235405 1
drm_kms_helper 159169 1 vmwgfx
ttm 99345 1 vmwgfx
drm 370825 4 ttm,drm_kms_helper,vmwgfx
vmw_pvscsi 23114 3
[root@prod-proxy ~]# lsmod |grep balloon
[root@prod-proxy ~]#
[root@prod-proxy ~]# free -h
total used free shared buff/cache available
Mem: 3.7G 616M 2.7G 114M 434M 2.7G
Swap: 3.9G 257M 3.6G
[root@prod-proxy ~]#
[root@prod-proxy ~]# smem -twp
Area Used Cache Noncache
firmware/hardware 0.00% 0.00% 0.00%
kernel image 0.00% 0.00% 0.00%
kernel dynamic memory 13.26% 9.75% 3.51%
userspace memory 14.53% 1.03% 13.50%
free memory 72.21% 72.21% 0.00%
----------------------------------------------------------
100.00% 82.98% 17.02%
[root@prod-proxy ~]# smem -tw
Area Used Cache Noncache
firmware/hardware 0 0 0
kernel image 0 0 0
kernel dynamic memory 514664 378436 136228
userspace memory 564016 39828 524188
free memory 2803388 2803388 0
----------------------------------------------------------
3882068 3221652 660416
网友评论