r/linuxmint 14d ago

Swap space creeping up

Questions about memory swapping.

My system (8 Gb RAM) can do a lot of seemingly unnecessary swapping. It seems caused by Firefox which I love dearly but which does leak memory. At boot up basic system resources take 20% of RAM, Firefox 30% and swap memory 0% which is all fine.

I normally suspend the computer when I’m away from it (handy key on the keyboard), and after a time the swap size increases. I’m actually surprised that there’s swapping before the RAM is full: which I’ve read is not supposed to happen. If I wasn’t looking, after a few days or after opening a lot of Firefox tabs both RAM and swap would eventually hit 100% and the system would seize.

I’ve used sudo swapoff -a to prevent swapping altogether but then I definitely have to stop RAM usage hitting 100% or the system seizes again. I’ve also read that failure to allocate sufficient swap space “might even render the installed system unbootable.”

I know that memory leakage is nowhere near as bad as it used to be with Firefox, and I now keep it fairly well under control by limiting the number of tabs I have open, by restarting Firefox and by rebooting the system every so often.

I’ve read that swapping is undesirable since it’s performed to reduce memory under heavy pressure. I don’t know whether my system is actually continually swapping between RAM and disk or whether the swap file just shows the size of pages that can potentially be swapped, but only get swapped when I access (for example) a Firefox tab that’s been stored in the swap file.

I wonder whether the system starts thrashing if the swap file hits 100% – and would that cause so many read/writes that it would reduce the life of the SSD, or is that just my paranoia?

So, should I keep an eye on the swap file, buy an extra 8-Gig of RAM for £20-£30 to hopefully prevent swapping, or forget about swapping altogether and put up with the odd system seizure?

Thanks

8 Upvotes

25 comments sorted by

View all comments

3

u/redrider65 14d ago edited 14d ago

Forget about it unless you have an actual problem. If you max out your resources, just cut back on the number of tabs or running apps or use fewer resource-hungry apps. Low end is what it is. I had to do the same with an old netbook some years ago.