In Debian based distros (Ubuntu, Linux Mint etc.), the tendency of the operating system to use swap memory is defined by the swappiness. You can view this value by executing the following command:
The value of swappiness can range from 0 (least tendency to use swap) to 100 (high tendency to use swap). The default value is 60. A higher value of swappiness is usually desirable for servers. However for home users, a lower value is often favourable, especially when there is more than 512MB of ram on the system.
To change the value of swappiness, edit the /etc/sysctl.conf file. To do so type the following in the terminal:
gksudo gedit /etc/sysctl.conf
Add at the bottom of that text file, the following lines (copy and paste):
# Reduce the swap tendency
vm.swappiness = 10