Movatterモバイル変換


[0]ホーム

URL:


Jump to content
WikipediaThe Free Encyclopedia
Search

Out of memory

From Wikipedia, the free encyclopedia
State of computer where no additional memory can be allocated
Out of memory screen display on system runningDebian 12 (Linux kernel 6.1.0-28)

Out of memory (OOM) is an often undesired state ofcomputer operation where no additionalmemory can beallocated for use by programs or theoperating 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 diskswap space, has been allocated.

History

[edit]

Historically, the out-of-memory condition was more common than it is now, since early computers andoperating systems were limited to small amounts of physicalrandom-access memory (RAM) due to the inability of early processors to address large amounts of memory, as well as cost considerations. Since the advent ofvirtual 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 asMS-DOS lacked support formultitasking. Programs were allocated physical memory that they could use as they needed. Physical memory was often a scarce resource, and when it was exhausted by applications such as those withterminate-and-stay-resident functionality, no further applications could be started until running applications were closed.

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 viammap (onUnix-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] (For example, Windows usescommit charge accounting to limit the size of virtual memory.)

As predicted byMoore's law, the amount of physical memory in all computers has grown almost exponentially, although this is offset to some degree by programs and files themselves becoming larger. In some cases, a computer with virtual memory support where the majority of the loaded data resides on the hard disk may run out of physical memory but not virtual memory, thus causing excessivepaging. This condition, known asthrashing, usually renders the computer unusable until some programs are closed or the machine is rebooted. Due to these reasons, an out-of-memory message is rarely encountered by applications with modern computers.[citation needed]

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 afterfork().[further explanation needed]

Recovery

[edit]

The kernels of operating systems such asLinux will attempt to recover from this type of OOM condition by terminating one or more processes, a mechanism known as theOOM Killer.[1][2]Linux 4.6 (released in May 2016) introduced changes in OOM situations, improving detection and reliability.[3][4]cgroup awareness in OOM killer was implemented inLinux kernel 4.19 released in October 2018, which adds an ability to kill a cgroup as a single unit.[5]

Due to late activation ofOOM Killer on some Linux systems,[6] there are several daemons and kernel patches that help to recover memory from OOM condition before it was too late.

  • earlyoom[7]
  • nohang[8]
  • systemd-oomd
  • PSI (pressure stall information) kernel patches and the accompanyingoomd daemon, the patches are merged in Linux kernel 4.20.[9][10]

Per-process memory limits

[edit]

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-end32-bit systems (such as those withPhysical Address Extension enabled) come with 8gigabytes or more of system memory, even though any single process can only access 4 GB of it in a 32-bitflat memory model.

A process that exceeds its per-process limit and then attempts to allocate further memory will encounter an error condition. For example, theC standard function for allocating memory,malloc(), will returnNULL if it fails to allocate and a well-behaved application should handle this situation. Standard C++operator new will throwbad_alloc upon failure, though not necessarily when physical RAM is exhausted, but rather when virtual memory allocation fails. InJava, if theJava Virtual Machine (JVM) runs out of memory, it will throwOutOfMemoryError, and inC#, aOutOfMemoryException is thrown.POCO C++ Libraries has aOutOfMemoryException class which it throws if aMemoryPool runs out of memory.

References

[edit]
  1. ^Linux OOM Killer
  2. ^"How to Configure the Linux Out-of-Memory Killer". Retrieved19 February 2015.
  3. ^"Toward more predictable and reliable out-of-memory handling [LWN.net]".lwn.net.
  4. ^"Linux_4.6 - Linux Kernel Newbies".kernelnewbies.org.
  5. ^"Linux_4.19 - Linux Kernel Newbies".kernelnewbies.org.
  6. ^"linux kernel - Is it possible to make the OOM killer intervent earlier?".Super User. Retrieved7 March 2021.
  7. ^rfjakob (7 March 2021),rfjakob/earlyoom, GitHub, retrieved7 March 2021
  8. ^Avramov, Alexey (5 March 2021),hakavlad/nohang, GitHub, retrieved7 March 2021
  9. ^"linux-psi.git - Linux resource pressure metrics".git.cmpxchg.org. Archived fromthe original on 22 January 2021. Retrieved7 March 2021.
  10. ^facebookincubator/oomd, Facebook Incubator, 3 March 2021, retrieved7 March 2021

External links

[edit]
System failure
Application failure
Device and data errors
Other
Lists
Related
Retrieved from "https://en.wikipedia.org/w/index.php?title=Out_of_memory&oldid=1334242787"
Categories:
Hidden categories:

[8]ページ先頭

©2009-2026 Movatter.jp