Clear Swap File on Shutdown

Posted May 27, 2005 | by David Risley  

The swap file is a file which your computer uses on the hard drive that acts as virtual memory. Whenever Windows does not have enough actual memory to do what it needs to do, it uses the swap file. In some instances, people may want to delete the swap file whenever they shut down their computer. For instance, if the work you are doing is sensitive, you might want to do so as somebody with knowhow could read your data from the swap file. To enable this in XP, do the following:

1. Navigate to HKEY_LOCAL_MACHINE > SYSTEM > CurrentControlSet > Control > Session Manager > Memory Management
2. Select ClearPageFileAtShutdown from the list on the right.
3. Right on it and select Modify.
4. Change the value to 1 to enable.
5. Reboot your computer.

Note that this will significantly increase the amount of time it takes to shut down your computer.

Which Of These Traits Applies To YOUR Computing Life?...

2 Responses to “Clear Swap File on Shutdown”

  1. Larry Miller says:

    The risks of not doing this are more theoretical than real. It is possible to obtain access to confidential data this way but it is not easy. There are usually other ways which require less effort. This might be useful in a highly secure environment but only as part of a comprehensive security policy. By itself it will provide little security.

    Note that this does not delete the pagefile but overwrites every byte with zero’s. There are NO performance benefits in doing this.

    Larry Miller
    Microsoft MCSA

  2. Lood Kazaz says:

    Thanks for the post.

    This will benefit more if we need to use the same HDD for back up while not using it as OS Drive. i.e. I have 3 hard drive for my laptop. each one has completely different data and operating system. One of them that has winXP carry all my files on another partition and I would not use this HDD all the time so I do nor need ro waste 1 or 2 GB caused by Swap files.

Leave a Reply