SWAP memory is basically parts of memory from the RAM (Random Access Memory) that enables an operating system to provide more memory to a running application or process than is available in physical random access memory (RAM). So if the physical memory (RAM) is full, we can use SWAP partition for extra memory resources. It is useful if we have low memory on our machine.
sudo dphys-swapfile swapoff
As root, edit the file /etc/dphys-swapfile and modify the variable CONF_SWAPSIZE:
sudo nano /etc/dphys-swapfile
Edit the line and enter decide swap size in MB
CONF_SWAPSIZE=1024
and save ^ + x
Run
sudo dphys-swapfile setup
sudo dphys-swapfile swapon