Clearing swap and hibernation files properly

Two neglected open books

If you're lazy, and cheap

Finally, there is a less secure, but convenient and free, approach for Windows users. You can set your swap file for automatic deletion each time you reboot or shut down your system. It's not a secure wipe, but if you've chosen a fixed-size swap file as I recommend, there's a fair chance that old data will gradually be overwritten as a new swap file is created each time you reboot. There's no guarantee that a new file will overwrite a previous one (because there's no guarantee that it will occupy the same physical disk area as a previous one), but this is a very easy thing to do, it costs nothing, and it's certainly better than neglecting the swap file entirely.

To set up your swap file for automatic deletion, go to Start ==> Run ==> and type regedit. The registry editor will launch. Before you make any changes to your registry, make a copy of it. In the left-hand pane of the registry editor, select the top level, labelled "My Computer". Now, in the upper menu bar, go to File ==> Export. In the export dialogue box, be sure to choose "All" in the Export Range option toward the bottom of the box. Now save your registry. If your changes cause any problems, you can re-install your previous registry files simply by opening the editor, choosing File ==> Import from the menu bar, and reversing the process.

Now, to set your swap file for automatic deletion, here's all you need to do:

In the left-hand pane of the registry editor, navigate to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management. Next, in the right-hand pane, select ClearPageFileAtShutdown. Right click on it, choose "Modify", and change the value to 1. Reboot, of course.

Edit Registry

You can tell that it's working because shutting down Windows will take noticeably longer than before. Obviously, if you're in the habit of simply powering off your computer, you won't get much benefit from this. You do have to shut down normally for it to work.

Sponsored: Driving business with continuous operational intelligence