Set memory-related kernel parameters

Setting a parameter temporarily is useful for determining the effect the parameter has on a system. You can later set the parameter persistently when you are sure that the parameter value has the expected effect.

Procedure

  • To temporarily set the memory-related kernel parameters, edit the respective files in the /proc file system or the sysctl tool. For example, to temporarily set the vm.overcommit_memory parameter to 1:
    # echo 1 > /proc/sys/vm/overcommit_memory
    # sysctl -w vm.overcommit_memory=1
  • To persistently set the memory-related kernel parameter, edit the /etc/sysctl.conf file and reload the settings. For example, to persistently set the vm.overcommit_memory parameter to 1:
    • Add the following content in the /etc/sysctl.conf file:
      vm.overcommit_memory=1
    • Reload the sysctl settings from the /etc/sysctl.conf file:
      # sysctl -p