One way to make sure of optimal performance of the swap file (Virtual Memory) is this:
1) Use Windows built-in "Disk Cleanup"
2) Use Windows built-in "Disk Defragmenter"
3) Shut down (reboot) the computer
4) Follow the method outlined below
Virtual memory, also called page file or swap file, is a file on your hard drive (C:\pagefile.sys by default) that Windows and applications use in addition to physical memory (RAM) as needed.
The rule of thumbs for the size of this file is 1.5 times the amount of physical memory, it is also recommended to make the minimum and maximum size the same to avoid serious fragmentation.
Here are a few examples:
512 MB RAM = 768 MB Page File - 1 GB (1024 MB) RAM = 1.5 GB (1536 MB) Page File - 2 GB (2048 MB) RAM = 3 GB (3072 MB) Page File - 3 GB (3072 MB) RAM = 4.5 GB (4608 MB) Page File and so on.
Getting your paging file into shape is a simple operation, if you're confident delving into submenus and manually making adjustments.
In Windows XP, open your My Computer Properties, then under the Advanced tab click on Performance Settings, hit the Advanced tab in the new window, and click on Virtual Memory Change. The paging file should be set to at least 1.5 times the amount of RAM onboard. Many experts caution against any smaller than that. Set both the Initial Size and Maximum Size to the same level. By doing this, you prevent the paging file from growing incrementally and adding to disk fragmentation.
Vista users face a similar procedure. From the Start menu, hit the Computer button on the right, and then right-click on your C drive and choose System. From there, click on Advanced System Settings and under the Advanced tab, choose Performance Settings. Choose the Advanced tab in the window that opens and Change Virtual Memory. Vista users should follow the same guidelines as those with XP machines: keep the Initial Size and Maximum Size the same, but no less than one and a half times the amount of RAM you've got.
( Don't worry about making all those operations, as long as you take your time (go slowly) and follow the steps one by one in order, everything will be fine (I know because I've done that many times and I wasn't an expert the first time) )
NOTES:
This operation needs to be done only once and will only need to be repeated if you change the amount of RAM.
If you have more than one drive, the paging file should always be on the "FASTEST" drive not just the biggest one.