what is swap.sys and How Do You Delete It?
windows 10 and (8) 包含了一个新的虚拟内存文件swapfile.sys. 它和pagefile.sys, hiberfil.sys一起存储在你的系统盘。但是为什么windows同时需要pagefile.sys和swapfile.sys.
windows 交换一些没有被使用的数据到swapfile. 当前这个文件主要用于这些新的软件, 称为 “universal apps” 。 以前被人们称为Metro apps. 在未来windows可能有更多关于它们的应用。
和pagefile.sys, hiberfile.sys一样,这个文件默认存储在你的系统盘-C:\。swapfile帮助windows8, windows 10实现了” hybrid boot ” 快速引导功能。 pagefil是用于操作系统储存内存中的一部分分页, 当你的RAM没有空间, 或者系统需要更多的内存的时候。
what is the swap file for?
关于这个文件, 没有更多的官方文档。 但是我们可以一起, 从微软官方的博客文章和论坛回应, 拼凑出一个答案。
总的来说, swapfile当前是用于交换出微软的一个新风格的app。 微软将这些app称为universal app, windows Store apps, Metro app, Moder apps, Windows 8 apps, Windows 8-style UI apps, 和其它方面的不同产品。
这些app与传统windows桌面程序的管理不一样。 windows管理这些app的内存更加智能(intelligently)。Here is how Microsoft’s Black Morrison explains it:
“You may ask , ‘Why do we need another virtual page file?’ Well, weith the introduction of the Modern App, we needed a way to manage their memory out of the traditional Virtual Memory/Pagefile method.”
“Windows 8 can efficiently write the whole(private) working set of a suspended Modern app to disk in order to gain additional memory when the system detects the pressure. This process is analogous to hibernating a specific app, and then resuming it when the user switches back to the app. In thsi case windows 8 take advantage of the suspend/resume mechanism of Modern apps to empty or re-populate an app’s working set.”
为了保存app的“休眠状态”的内存状态, windows 将unversal apps不需要的比特数据交换到swapfile.sys, 而不是使用标准的pagefile.sys文件。
Microsoft’s Pavel Lebedinsky explains a bit more:
挂起(suspend)/重启(resume) Metro-stytle apps 只是一个应用场景, 在将来会有更多的其它的应用。
就内存预留(space reservation),动态增长(dynamic growth), 读写策略(read/write policies)等方面来说, swapfile.sys 和 pagefile.sys在不同的使用模式和不同的使用条件(requirements)。
根本上说, 就是标准的pagefile.sys 用于windows 普通的应用, 然而Microsoft’s new app framework使用一个单独的类型文件swapfile.sys, 以便于更智能(intellegently)交换内存。
How Do I Delete the Swapfile.sys File?
当前这个文件实际上很小, 最大的情况下大约有256MB。 你应该没有必要删除它。 即使你是某种只有很小内在的平板(tablet), swapfile.sys可能使它更流畅。
swapfile.sys是和pagefile.sys一起管理的。 Disable pagefile, 同样会disable swapfile.
我们真的不推荐这样做, 因为disable your page file是一个很坏的想法。
但是如果你真想这么做的话, 你可以删除它。为了访问恰当的对话框,打开开始按钮(start menu)->输入”performance”,->选择”adjust the appearance and performance the windows” 设置快捷方式。
在“performance options window”, 在高级tab下点击veritual memory里的change button。
取消(uncheck)”automatically manage paging file size for drives”, 选择“No page file”, and click set. 在你重启电脑后, swapfile.sys和pagefile.sys都会从盘里移除。
你也可以在这里设置, 另一个盘重新创建一个page file(虚拟页面文件), windows将会把你的虚拟页面存储到这个盘里, 让你可以减轻你的固态硬盘的负载(猜的,原:solid-state drive), 把虚拟页面放到机械硬盘中。
click OK, 然后你的PC. swapfile.sys 和 pagefile.sys将会从你的盘里消失,重新创建这个文件, 再次访问这个对话框,设置你的一个盘里(c:\ or .etc)的虚拟页面文件大小。