Yes you’re much better with swap than without.
will tell you how to create a swapfile
More details on swap can be found here
I remember when I stole 4GB of RAM from a box (ie. box went from 8GB down to 4GB as I needed 4GB to test another box with issues) and I didn’t expect to notice a difference - boy was I wrong! That box didn’t have swap enabled & it became horrific to use with only 4GB. By simply adding swap, the machine was back to normal; at least it felt that way to me (for the remaining days before I got my 8GB back)
You didn’t provide any release details.
Lubuntu 22.04 LTS includes systemd-oomd
which monitors RAM & autokills when it gets low; I talked about it a little here…
In my own usage, I use extensions on both firefox
and chromium
that are a little buggy and lead to memory leaks… The browsers are fine if used without those extensions, but I want the benefits of the extensions thus use them leading to the RAM leak issue… It’s this issue that made me really notice the systemd-oomd
change in jammy, but it’s an issue I’ve had for years, and just dealt with on prior releases (pre systemd-oomd
) via a terminal open with htop
… When I felt the system slow a little; I’d look at htop
for clues of what I felt was memory-leak; then just close the browser impacted (be it firefox
or chromium
- or both), wait a little (giving the linux kernel time to clean up the memory), then re-start the browsers… Using it this way was my preferred option to having no-adblocker on the browsers.
With 4GB of RAM - you need swap, esp. if you’re using a web-browser.