博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
fork failed because of Out Of Memory
阅读量:7056 次
发布时间:2019-06-28

本文共 1374 字,大约阅读时间需要 4 分钟。

Maybe virtual memory over commit is prevented in your system.

If it is prevented, then the virtual memory can not be bigger than sizeof physical RAM + swap. If it is allowed, then virtual memory can be bigger than RAM+swap.

When your process forks, your processes (parent and child) would have 2*180GB of virtual memory (that is too much if you don't have swap).

So, allow over commit by this way:

echo 1 > /proc/sys/vm/overcommit_memory

It should help, if child process execves immediately, or frees allocated memory before the parent writes too much to own memory. So, be careful, out of memory killer may act if both processes keep using all the memory.

man page of proc(5) says:

/proc/sys/vm/overcommit_memory

This file contains the kernel virtual memory accounting mode. Values are: 0: heuristic overcommit (this is the default) 1: always overcommit, never check 2: always check, never overcommit

In mode 0, calls of mmap(2) with MAP_NORESERVE are not checked, and the default check is very weak, leading to the risk of getting a process "OOM-killed". Under Linux 2.4 any nonzero value implies mode 1. In mode 2 (available since Linux 2.6), the total virtual address space on the system is limited to (SS + RAM*(r/100)), where SS is the size of the swap space, and RAM is the size of the physical memory, and r is the contents of the file /proc/sys/vm/overcommit_ratio.

转载地址:http://lhrol.baihongyu.com/

你可能感兴趣的文章
河北汽车客运站异地联网售票!那些你不知道的事
查看>>
我们需要什么样的威胁情报分析师?
查看>>
超过24%!天合光能IBC电池效率再创新高
查看>>
MySQL两千万数据优化&迁移
查看>>
《UNIXLinux程序设计教程》一2.3 打开和关闭流
查看>>
《Android的设计与实现:卷I》——第2章 2.5 JNI操作Java对象
查看>>
FBI和DHS在响应网络攻击时为何存在分歧
查看>>
《系统分析与设计方法及实践》一3.1 案例研究中涵盖的内容
查看>>
湖北省开启能源供给侧改革 将重点发展光伏发电
查看>>
美国伊利诺伊州响应区块链技术倡议活动 将举办黑客马拉松
查看>>
阿里音乐打算用大数据发掘下一个TFboy
查看>>
大数据能否成帮助人类 控制寨卡病毒疫情
查看>>
大数据为推动中国出版“走出去”提供新机遇
查看>>
Nest应用登陆tvOS 可在大屏幕上进行监控了
查看>>
Tumblr遭遇数据泄露 6000多万名用户受波及
查看>>
新的系统漏洞使iOS10更容易被攻破,苹果称已开始修复
查看>>
物联网路径,美国运营商怎么走?
查看>>
除Hadoop大数据技术外,还需了解的九大技术
查看>>
印度限制官员使用智能手机:真因为怕中国黑客?
查看>>
沪穗深百万地铁族担心:花生WiFi到底安全吗?
查看>>