I've been looking into memory overcommitting in Linux using
/proc/sys/vm/overcommit_memory, and I've read a few articles which don't say the same thing.
This doc, under the heading "Going in the wrong direction", goes on to say, "values 1: do overcommit, and 0 (default): don't", but then in the next few lines, it mentions, amongst similar things, that this isn't actually true and that 0 means "guess about how much overcommitment is reasonable". That means that memory overcommit isn't disabled using value 0, right?
It also says that 1 indicates "never refuse any malloc()", with 2 meaning "be precise about the overcommit - never commit a virtual address space larger than swap space plus a fraction overcommit_ratio of the physical memory."
The Red Hat magazine, on the other hand states, "if the value is 0, then the kernel checks to determine if there is enough memory free to grant a memory request to a malloc call from an application. If there is enough memory, then the request is granted. Otherwise, it is denied and an error code is returned to the application." This sounds exactly like disabling overcommit.
"If the value is set to 1, then the kernel grants allocations above the amount of physical RAM and swap in the system as defined by the overcommit_ratio value.... If the setting in this file is 2, the kernel allows all memory allocations, regardless of the current memory allocation state." In terms of values 1 and 2, that is the opposite of what the previous doc said, right?
Does anyone know what is actually correct, and if it is possible to 'disable' overcommit?