Ubuntu freezing with high memory usage: Difference between revisions
From WickyWiki
Created page with "Category:Ubuntu Category:Ubuntu System Category:20170320 * http://askubuntu.com/questions/41778/computer-freezing-on-almost-full-ram-possibly-disk-cache-problem T..." |
mNo edit summary |
||
| Line 10: | Line 10: | ||
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. | 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. | ||
<!-- keywords: cpu hogging cpulimit --> | |||
<syntaxhighlight lang=bash> | <syntaxhighlight lang=bash> | ||
| Line 21: | Line 22: | ||
vm.min_free_kbytes=65536 | vm.min_free_kbytes=65536 | ||
</syntaxhighlight> | </syntaxhighlight> | ||
See also: | |||
* https://ubuntuforums.org/showthread.php?t=992706 (cpulimit) | |||
Revision as of 04:15, 5 August 2017
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 vm.swappiness=5 # limit proces memory usage # 6% of 2Gb * 1024 / 2 cores plus some bits vm.min_free_kbytes=65536
See also: