Memory overcommit
2010-12-31 09:48
197 查看
Memory overcommit
Memory overcommit is a Linux kernel feature that lets applications allocate more memory than is actually available. The idea behind this feature is that some applications allocate large amounts of memory "just in case", but never actually use it. Thus, memory overcommit allows you to run more applications than actually fit in your memory, provided the applications don't actually use the memory they've allocated. If they do, then the kernel terminates the application.
In particular, you may have problems when using a kernel that has memory overcommit enabled. This may result in a specific process being killed as it tries to load the file. To try and solve the problem, you can either increase the amount of memory (by adding RAM or swap), or you can disable memory overcommit by typing (as root):
[/code]
The OOM killer exists because the Linux kernel, by default, can commit to supplying more memory than it can actually provide. Overcommitting memory in this way allows the kernel to make fuller use of the system's resources, because processes typically do not use all of the memory they claim. As an example, consider the fork() system call, which copies all of a process's memory for the new child process. In fact, all it does is to mark the memory as "copy on write" and allow parent and child to share it. Should either change a page shared in this way, a true copy is made. In theory, the kernel could be called upon to copy all of the copy-on-write memory in this way; in practice, that does not happen. If the kernel reserved all of the necessary virtual memory (which includes swap space), some of that space would certainly go unused. Rather than waste that space - and fail to run programs or memory allocations that, in practice, it could have handled - the kernel overcommits itself and hopes for the best.
Memory overcommit is a Linux kernel feature that lets applications allocate more memory than is actually available. The idea behind this feature is that some applications allocate large amounts of memory "just in case", but never actually use it. Thus, memory overcommit allows you to run more applications than actually fit in your memory, provided the applications don't actually use the memory they've allocated. If they do, then the kernel terminates the application.
In particular, you may have problems when using a kernel that has memory overcommit enabled. This may result in a specific process being killed as it tries to load the file. To try and solve the problem, you can either increase the amount of memory (by adding RAM or swap), or you can disable memory overcommit by typing (as root):
$
echo 2 > /proc/sys/vm/overcommit_memory
[/code]
The OOM killer exists because the Linux kernel, by default, can commit to supplying more memory than it can actually provide. Overcommitting memory in this way allows the kernel to make fuller use of the system's resources, because processes typically do not use all of the memory they claim. As an example, consider the fork() system call, which copies all of a process's memory for the new child process. In fact, all it does is to mark the memory as "copy on write" and allow parent and child to share it. Should either change a page shared in this way, a true copy is made. In theory, the kernel could be called upon to copy all of the copy-on-write memory in this way; in practice, that does not happen. If the kernel reserved all of the necessary virtual memory (which includes swap space), some of that space would certainly go unused. Rather than waste that space - and fail to run programs or memory allocations that, in practice, it could have handled - the kernel overcommits itself and hopes for the best.
相关文章推荐
- overcommit_memory
- about overcommit_memory
- sysctl 中 vm.overcommit_memory 的含义
- 有关linux下redis overcommit_memory的问题(转)
- redis启动提示vm.overcommit_memory、somaxconn警告错误
- vm.overcommit_memory和vm.overcommit_ratio
- 有关linux下redis overcommit_memory的问题
- 又一次内存分配失败(关于overcommit_memory)
- linux-overcommit_memory
- 有关linux下redis overcommit_memory的问题
- overcommit_memory 内核参数
- 【linux】 vm.overcommit_memory 内核参数
- Redis overcommit_memory参数说明:
- overcommit_memory
- Linux 系统 vm.overcommit_memory 内核参数
- 有关linux下redis overcommit_memory的问题
- rocketmq涉及到的系统参数 (overcommit_memory)
- 有关linux下redis overcommit_memory的问题
- overcommit_memory
- 操作系统内存配置overcommit_memory