Out of memory
From Wikipedia, the free encyclopedia
Out of memory (OOM) is a pathological state of computer operation where all available virtual memory has been allocated. 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.
Historically, the out of memory condition was more common than it is now - early computers (including personal computers) and operating systems were limited to small amounts of physical Random Access Memory due to low addressability limits and cost considerations, and lacked support for virtual memory on a hard drive (if the system did indeed have one). It was usually a problem with single-tasking operating systems that had the ability to retain multiple programs in memory at once (for example, the terminate and stay resident functionality of Microsoft DOS. At some point, the user would be forced to delete some programs before any more could be loaded.
Today, the out of memory condition is rare due to the implementation of virtual memory on a hard drive. Operating systems such as Microsoft Windows 95 and later versions, as well as Linux also automatically manage virtual memory usage so that RAM is used more efficiently. Due to Moore'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. It should be noted that, in most cases, a computer with virtual memory support where the majority of the loaded data resides on the hard disk would probably run so slowly that it would be considered to have failed, prompting the user to delete some programs or reboot. As such, an out of memory message is rarely encountered with modern computers.
Operating systems such as Linux will attempt to recover from an OOM condition by terminating a low-priority process, a mechanism known as the OOM Killer.
Running processes that experience an OOM condition will have attempts to allocate further memory, for example with malloc()
, return failure. A well-behaved application should handle this situation gracefully; however, many do not. An attempt to allocate memory without checking the result is known as an "unchecked malloc".
[edit] External links
- Linux OOM Killer
- Out of Memory handling
- Article "Minimizing Memory Usage for Creating Application Subprocesses" by Greg Nakhimovsky
- Article "When Linux Runs Out of Memory" by Mulyadi Santosa
- Paper "Handling “Out Of Memory” Errors" by John Boyland
- std::bad_alloc Class Reference