Swap memory is a storage space on the disk which is used when there is no RAM space available for programs execution. Can happen that system uses swap memory even when there is a lot of RAM available for use. In such case swap memory can be cleared manually. This tutorial shows how to clear swap memory in Linux.
Before clearing swap memory, need to check if there is enough free RAM available in the system. This means that free RAM should be available more than the current swap memory in use. Run the following command to check memory usage in the system:
total used free shared buff/cache available Mem: 11953 311 11544 0 98 11440 Swap: 4095 112 3983
As we can see there is enough free RAM available and swap memory can be cleared.
To clear swap memory, disable it by using
swapoff command and enable it again by using
sudo swapoff -a && sudo swapon -a