Turning off memory overcommit on Linux

March 2012


Chapter 9, on Memory of Andries Brouwer's Some Remarks on the Linux Kernel (that title is a huge understatement), holds the steps to turn of memory overcommit:

  1. root@server:~# echo 2 > /proc/sys/vm/overcommit_memory

  2. root@server:~# echo 80 > /proc/sys/vm/overcommit_ratio

  3. root@server:~# cat <<EOF >> /etc/sysctl.conf
    # 0 = default, 1 = malloc always succeeds, 2 = strict overcommit
    vm.overcommit_memory = 2
    # commit no more virtual address space than swap + 80% of RAM
    vm.overcommit_ratio = 80
    EOF

    Oh, and RedHat has a few useful notes on /proc/meminfo.

A few more relevant links...