It often happens that we have free RAM (free or cached) but the SWAP virtual memory is occupied. We can empty the swap memory like this:
swapoff -a
We wait a few minutes (depending on how much swap is used). Eventually we can run this command in backgroud or in a screen. This command clears SWAP memory in RAM and disables SWAP (all partitions in / etc / fstab).
When the command has been executed, we activate SWAP back by:
swapon -a
We can check the memory status with:
free -m
Or you can run everything in one command:
swapoff -a && swapon -a