xEntering the following commands in sequence can increase the swap space by 3G and solve some program errors that run out of memory.
sudo fallocate -l 3G /var/swapfile
sudo chmod 600 /var/swapfile
sudo mkswap /var/swapfile
sudo swapon /var/swapfile
sudo bash -c 'echo "/var/swapfile swap swap defaults 0 0" >> /etc/fstab'
sudo fallocate -l 3G /var/swapfile
sudo chmod 600 /var/swapfile
sudo mkswap /var/swapfile
sudo swapon /var/swapfile
sudo bash -c 'echo "/var/swapfile swap swap defaults 0 0" >> /etc/fstab'
View the effect and open the terminal input
xxxxxxxxxx
jtop
Swap has become 6g.