Out of memory
![]() | This article needs additional citations for verification. (December 2014) ) |

Out of memory (OOM) is an often undesired state of computer operation where no additional memory can be allocated for use by programs or the operating system. Such a system will be unable to load any additional programs, and since many programs may load additional data into memory during execution, these will cease to function correctly. This usually occurs because all available memory, including disk
History
Historically, the out of memory condition was more common than it is now, since early computers and operating systems were limited to small amounts of physical random-access memory (RAM) due to the inability of early processors to address large amounts of memory, as well as cost considerations. Since the advent of virtual memory opened the door for the usage of swap space, the condition is less frequent. Almost all modern programs expect to be able to allocate and deallocate memory freely at run-time, and tend to fail in uncontrolled ways (crash) when that expectation is not met; older ones often allocated memory only once, checked whether they got enough to do all their work, and then expected no more to be forthcoming. Therefore, they would either fail immediately with an "out of memory" error (OOME) message, or work as expected.[citation needed]
Early operating systems such as
Modern operating systems provide virtual memory, in which processes are given a range of memory, but where the memory does not directly correspond to actual physical RAM. Virtual memory can be backed by physical RAM, a disk file via mmap (on Unix-derivatives) or MapViewOfFile (on Windows), or swap space, and the operating system can move virtual memory pages around as it needs. Because virtual memory does not need to be backed by physical memory, exhaustion of it is rare, and usually there are other limits imposed by the operating system on resource consumption.[citation needed]
As predicted by
It is, however, still possible to encounter an OOM condition with a modern computer. The typical OOM case in modern computers happens when the operating system is unable to create any more virtual memory, because all of its potential backing devices have been filled or the end-user has disabled them. The condition may arise because of copy-on-write after fork().
Out of memory management
The kernels of operating systems such as
Due to late activation of OOM Killer on some Linux systems,[5] there are several daemons and kernel patches that help to recover memory from OOM condition before it was too late.
earlyoom
[6]nohang
[7]- PSI (pressure stall information) kernel patches and the accompanying
oomd
daemon, the patches are merged in Linux kernel 4.20.[8][9]
Per-process memory limits
Apart from the system-wide physical memory limits, some systems limit the amount of memory each process can use. Usually a matter of policy, such a limitation can also happen when the OS has a larger address space than is available at the process level. Some high-end
A process that exceeds its per-process limit and then attempts to allocate further memory will encounter an error condition. For example, the
References
- ^ "How to Configure the Linux Out-of-Memory Killer". Retrieved 19 February 2015.
- ^ "Toward more predictable and reliable out-of-memory handling [LWN.net]". lwn.net.
- ^ "Linux_4.6 - Linux Kernel Newbies". kernelnewbies.org.
- ^ "Linux_4.19 - Linux Kernel Newbies". kernelnewbies.org.
- ^ "linux kernel - Is it possible to make the OOM killer intervent earlier?". Super User. Retrieved 7 March 2021.
- ^ rfjakob (7 March 2021), rfjakob/earlyoom, GitHub, retrieved 7 March 2021
- ^ Avramov, Alexey (5 March 2021), hakavlad/nohang, GitHub, retrieved 7 March 2021
- ^ "linux-psi.git - Linux resource pressure metrics". git.cmpxchg.org. Retrieved 7 March 2021.
- ^ facebookincubator/oomd, Facebook Incubator, 3 March 2021, retrieved 7 March 2021
External links
- Linux OOM Killer
- Out of Memory handling
- Article "Minimizing Memory Usage for Creating Application Subprocesses" by Greg Nakhimovsky
- Article "Taming the OOM killer" by Goldwyn Rodrigues
- Article "When Linux Runs Out of Memory" by Mulyadi Santosa
- Paper "Handling “Out Of Memory” Errors Archived 2021-02-25 at the Wayback Machine" by John Boyland