Hyper-V虚拟机开机内存占用过高原因

用Hyper-V启动了两台虚拟机,一台Win7,另一台CentOS。但启动后都出现了一个现象,明明是刚启动,但是内存却几乎已经占满。查看任务管理器/TOP,并没有任何应用占用了内存,那么内存究竟是被什么占了呢。

可以看见,两个系统的内存占用率都达到了90%以上。Google后,serverfault上的一帖给出了原因:

You enabled Dynamic Memory. So, while there’s nothing requiring that memory in your VM, the hypervisor asked for the memory back, and received it. To make sure that this memory that the guest OS has released back to the hypervisor isn’t accidentally used (which would cause the guest OS to fault,) the Dynamic Memory integration component (a device driver) in the guest has allocated it. This is why the report shows the memory as allocated.

简单的说就是我在Hyper-V创建虚拟机时启用了动态内存,动态内存的机制是:比如你给虚拟机分配了8G内存,虚拟机实际占用1G,那么剩下的7G就会被Hyper-V服务器回收,回收的这部分也显示为占用,所以就全部被占满了。

参考:Guest VM showing HIGH memory usage when nothing is using the memory

暂无评论

发表评论

电子邮件地址不会被公开。 必填项已用*标注