What are "Swap Files?"

PretendHer

Member
Jan 30, 2000
197
0
0
I am curious to know what type files these are exactly. I use "Diskeeper Lite" and I see them listed on the report generated when I use it. And, how to delete them...If any or all are not necessary.

Thanks...and by the way...please speak in lay terms.
 

mechBgon

Super Moderator<br>Elite Member
Oct 31, 1999
30,699
1
0
The swap file is hard-drive space that the operating system reserves as an "overflow" area where it can stash data if it runs out of room in your physical memory. Typically, the more physical memory you have, the larger the swap file will end up (in Windows at least), so that there's enough room to stash a whole DIMMload of data and then some.
 

Lord Evermore

Diamond Member
Oct 10, 1999
9,558
0
76
Most of the time, you only have one swap file (also known as virtual memory, or the paging file). The operating system "pages" data into the paging file.

Windows usually is configured to dynamically resize the swap file, so that it can grow larger if needed (if you just keep starting programs and loading huge data files, real RAM isn't enough so Windows will just keep dumping "old" stuff into the swap file). Linux or Unix OSes generally have an entirely separate partition used for swap data.

It's not usually a good idea to disable the paging file in Windows. It doesn't reduce performance for the most part, because it's only used when you try to do too much for your physical memory to hold everything. If you tried to do that without a paging file, the OS would just say "sorry, not enough memory, close some programs". The most common time the page file gets used would be when you start up a big game like Unreal Tournament 2003 -- the OS dumps anything not game-related or required for the OS to function, into the paging file so the game has as much memory as possible. When you exit the game and go back to some other program that was running, the OS reads the data from the paging file back into real memory.
 

Rav3n

Senior member
Sep 7, 2002
209
0
0
I am going to try to make it even simpler...

When you are using all your RAM, Windows could either refuse to let you do anything anymore (only the case when it decides to crash), or it can use your harddrive as "pretend-ram." Your Swapfile is "pretend-ram" essentially. Every program you run, every graphic you display, every sound you play is all stored in RAM (ram stands for Random Access Memory). If you have 256mb of RAM, but you have 300 mb of stuff open/displayed/etc - Windows is setup to use your HD. The reason programs like Diskeeper like to "Optimize" your swapfile is because the swapfile is SLOOOOOOW. Accessing stuff on your HD is much slower than in RAM, but RAM cannot store stuff for large amounts of time. When the swapfile is "optimized" the program you are using takes all the little pieces of the swapfile (pieces are stored in different physical places on the HD) and puts them all close to each other. Think of it this way: you have a jigsaw puzzle in all its pieces... the pieces are spread out over a huge distance. Every time you want to find a piece, you have to get up off your arse and look at each individual piece and compare it to the others. This situation is like an UNoptimized harddrive. Optimization would be you sorting the pieces and putting them in nice groups - the corners, the sides, the middle section. Better software optimizers are more efficient - they will group middle pieces by color maybe, and therefore make even less work.... crappy optimizers will just group edges and middle pieces... Ok I think I have written enough.
 

Spikey289

Senior member
May 20, 2002
291
0
0
Good explanation Raven, I always tell people defragging is like sorting a messed up bookself back into alphbetical order.