Since installing Manjaro, I've experienced a few system freezes and had to force restart my computer.
I suspected the reason was probably not enough swap space. So I checked the swappiness on my computer, which turned out to be 60. Not knowing how swapping works, I thought a swappiness of 60 meant I had enough swap space.
Turns out swappiness didn't mean what I thought it meant and I didn't have any swap space allocated.
After creating an 8 gig swap file and activating it, my computer doesn't run out of ram anymore because the OS takes advantage of the swap space proactively.
How to create swap space
There are a few ways to create swap space. I'll introduce the simplest one, which I used.
- Create swapfile(M = Mebibytes, G = Gibibytes)
# fallocate -l 8G /swapfile
- Set permissions
# chmod 600 /swapfile
- After creating the correctly sized file, format it to swap:
# mkswap /swapfile
- Activate the swap file:
# swapon /swapfile
- Edit
/etc/fstab
by adding this line:/swapfile none swap defaults 0 0
Finally, check if you swap space is working htop
If you've activated your swap space successfully, you should see "swap" in your htop.
Reference
https://wiki.archlinux.org/index.php/Swap#Swap_file_creation