/proc/sys/vm/overcommit_memory
This file contains the kernel virtual memory accounting mode.
Values are:
0: heuristic overcommit (this is the default)
1: always overcommit, never check
2: always check, never overcommit
In mode 0, calls of mmap(2) with MAP_NORESERVE are not
checked, and the default check is very weak, leading to the
risk of getting a process "OOM-killed".
In mode 1, the kernel pretends there is always enough memory,
until memory actually runs out. One use case for this mode is
scientific computing applications that employ large sparse
arrays. In Linux kernel versions before 2.6.0, any nonzero
value implies mode 1.
In mode 2 (available since Linux 2.6), the total virtual
address space that can be allocated (CommitLimit in /proc/mem‐
info) is calculated as
CommitLimit = (total_RAM - total_huge_TLB) *
overcommit_ratio / 100 + total_swap
where:
* total_RAM is the total amount of RAM on the system;
* total_huge_TLB is the amount of memory set aside for
huge pages;
* overcommit_ratio is t