Ubuntu freezing with high memory usage: Difference between revisions

From WickyWiki
mNo edit summary
mNo edit summary
 
Line 15: Line 15:
sudo gedit /etc/sysctl.conf
sudo gedit /etc/sysctl.conf


# limit swappiness
# limit swappiness (0-100) 0=rarely, 100=often
vm.swappiness=5
vm.swappiness=5


# limit proces memory  usage
# limit proces memory  usage
# 6% of 2Gb * 1024 / 2 cores plus some bits
# 6% of 2Gb * 1024 / 2 CPU cores plus some bits
vm.min_free_kbytes=65536
vm.min_free_kbytes=65536
</syntaxhighlight>
</syntaxhighlight>
Line 25: Line 25:
See also:
See also:
* https://ubuntuforums.org/showthread.php?t=992706 (cpulimit)
* https://ubuntuforums.org/showthread.php?t=992706 (cpulimit)
* [[Ubuntu troubleshooting]]

Latest revision as of 15:44, 3 March 2018

To fix this you need to set the following setting to something around 5%-6% of your total physical RAM, divided by the number of cores in the computer:

Keep in mind that this is a per-core setting, so if I have 2GB RAM and two Cores, then I calculated 6% of only 1 GB and added a little extra just to be safe.

This forces the computer to try to keep this amount of RAM free, and in doing so limits the ability to cache disk files. Of course it still tries to cache them and immediately swap them out, so you should probably limit your swapping as well.


sudo gedit /etc/sysctl.conf

# limit swappiness (0-100) 0=rarely, 100=often
vm.swappiness=5

# limit proces memory  usage
# 6% of 2Gb * 1024 / 2 CPU cores plus some bits
vm.min_free_kbytes=65536

See also: