Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Why is it recommended that the swap partition size be double that of the RAM size?

Specifically, why would I need to store data stored in the RAM twice??

share|improve this question

3 Answers 3

up vote 6 down vote accepted

Swap partition having double the memory size is just a general guideline, not a hard and fast rule. You'll need minimum 1 X your memory size if you suspend-to-disk (hibernation), and add enough spare for usage of 'swapped' memory which goes beyond your physical one. Hence the recommended 1.5 to 2 times.

I would think it also depends on the nature of your application usage and size of your physical memory etc. If you have anything beyond 2GB RAM and using non-memory intensive applications most of the time, you might not need swap partition at all, not big one anyway.

Having a big swap file and slow harddisk can be really punishing for your system too.

Here are a few useful reads:

Ubuntu SwapFAQ
SUperuser - Swap partition size for 4GB RAM
Do I Need a Swap Partition and If So, How Big?

share|improve this answer
1  
Slow or not, it's always better to have a swap just in case, even if you don't need it, than risking running out of RAM with no swap available. –  Don Feb 21 '10 at 10:52
    
@Don, yea I agree it is safer to have swap partition. :) –  o.k.w Feb 21 '10 at 11:49

Specifically, why would I need to store data stored in the RAM twice??

The swop is simply for freeing up system memory. If you begin to run low on memory the system will free up memory by moving the least used data from memory onto the hard disk swap file. This of course has a speed penalty but it frees up memory for other applications.

With memory being so cheap you are always better off to have as much as you can afford. This way the swap gets very little access and your system stays nice and fast.

share|improve this answer

With a larger swap space, programs can use more RAM than is present on the computer. This is possible because even if the data takes up more space than fits in the physical memory at once, it cannot all be accessed at once - the swap is pulled into physical memory as it is needed. The alternative is to have programs randomly killed when memory runs out. This is particularly useful if you want to edit high resolution images or videos, or do 3d modeling or rendering, or run numerical analysis on large amounts of data, there are many kinds of programs that end up wanting insane amounts of RAM, where it is better to be able to have it run very slow than to have it unable to run at all without crashing.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.