Swap space on linux can be something that you need to enable to help you out. While adding more real RAM can be costly, require a reboot that you can't do or you just need to add a little bit for a short time more and it doesn't make sense to purchase an entire stick of ram for a short time(for example, like when compiling a program).
Enabling swap doesn't need to be a daunting task. In fact, it can be done quite easily in just a few short steps. The very first thing you need to do is decide how much swap you need. Normally this is done in gigabytes. In our example we are going to use 2 gigabytes.
fallocate -l 2G /swapfile
chmod 600 /swapfile
That's all you have to run. Just swap out the 2 on the first line to be whatever amount of swap you'd like to have. Once you have that done, you are good to go. You can use a tool like
htop to verify that what you've setup works properly.