Ubuntu freezing with high memory usage

From WickyWiki
Revision as of 15:44, 3 March 2018 by Wilbert (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

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: