About the Recommended Swap Size and Desktops

Currently, the FreeBSD handbook, in its section 2.6.1., states that “As a rule of thumb, the swap partition should be about double the size of physical memory (RAM). Systems with minimal RAM (less for larger-memory configurations) may perform better with more swap. Configuring too little swap can lead to inefficiencies in the VM page scanning code and might create issues later if more memory is added.”

Despite this, I think there are still those who recommend having much less swap based on a longstanding belief that would benefit from being updated.

FreeBSD handles memory very well. It classifies pages according to how frequently the different applications access them, which allows the system to know which ones are the least likely to be needed and can be moved to swap.

Modern software apps, on the other hand, handle memory horribly. Firefox and Chromium, for instance, accumulate memory as if it were infinite, even more so if you use certain extensions.

On other OSs, if you keep doing certain tasks with one of these apps for a period of time, the system runs out of memory and either kills the offending application, crashes, or becomes as sluggish as to be unmanageable.

In FreeBSD this doesn’t happen if you have enough swap. FreeBSD moves there the memory pages that are occupied but, in reality, not being accessed, and the system keeps running perfectly, or, at least, well enough as to keep being manageable.

According to my experience, following the handbook’s rule of thumb practically guarantees that you will never run out of memory due to any memory-hoarder application.
 
That recommandation is not generally useful.

In the end it depends on what you run on there, and that dictates how much RAM+swap you need. The more RAM you have the less swap you need - for the same workload.

A system actually actively using 2x RAM of swapspace can't be a productive system, not even with the fastest SSDs.
 
A system actually actively using 2x RAM of swapspace can't be a productive system
You have stated this as an absolute truth, which is at least bold, in my opinion. I just note it because you expressing yourself in this terms doesn't mean that you hold the universal truth. It's your opinion and it contradicts the rule of thumb of the handbook.

Additionally, having swap doesn't mean using it, it means it being there in case there is the need to use it to prevent worse outcomes. The swap is a security system. I still believe that the recommendation of the handbook is the best rule of thumb and should be more widespread as the de-facto general recommendation.
 
You have stated this as an absolute truth, which is at least bold, in my opinion. I just note it because you expressing yourself in this terms doesn't mean that you hold the universal truth. It's your opinion and it contradicts the rule of thumb of the handbook.

Additionally, having swap doesn't mean using it, it means it being there in case there is the need to use it to prevent worse outcomes. The swap is a security system. I still believe that the recommendation of the handbook is the best rule of thumb and should be more widespread as the de-facto general recommendation.

That's why I said "actually actively using" those 2x of swap. Of course swap that is unused doesn't do any harm.
 
I used 2GB default every install; apparently I had wild mem use while playing D3 but didn't notice anything :p (performance was good, nothing crashed)

Screenshot_2026-02-26_18-59-14.png
 
remember, that swap recommendations were formed when memory was relatively expensive compared to disk space. I could be an outlier, but I doubt it...after running for weeks my workstation shows virtually no swap being used. In fact I only ever go over 20% memory utilization when doing heavy data processing.

In deference to a debate above...it really depends on your individual case: purpose of machine, how much RAM you have, and how busy the machine is. Swap recommendations are better left as "read the recommendation and realize YMMV"

I think the more important discussion is whether to put swap on an SSD. I say don't, although some may rightly argue that SSD durability has gotten better in recent years.
 
I think the more important discussion is whether to put swap on an SSD. I say don't, although some may rightly argue that SSD durability has gotten better in recent years.
I do 2 drive wipes (blkdiscard and nvme-format) before installing an OS, and did that at least once a week for around 2 years this NVMe:

nvme.PNG


I had a Hynix P91 longer before that but remaining life was near 50% so I swapped it in another computer for video storage. Did similar to a Samsung 850 before that (it got 3 wipes hdparm security-erase + enhanced) and it's in my server now; I'm thinking my SSD writes is way-above average but I haven't seen a drive fail yet.
 
Back
Top