Linux Cannot allocate memory问题

 

 

 

查找了一下相关文档,发现这个错误的含义其实就是像它自己说的,没法分配内存了。

The problem is inherent with the way Java allocates memory when executing processes. When then exec(). Forking creates a child process by duplicating the current process. By duplicating the current process, the new child process will request approximately the same amount of memory as its parent process, essentially doubling the memory required. However, this does not mean all the memory allocated will be used, as exec() is immediately called to execute the different code within the child process, freeing up this memory. As an example, when Stash tries to locate git, the Stash JVM process must be forked, approximately doubling the memory required by Stash.

 

解决方案:

1. 编辑 /etc/sysctl.conf ,改vm.overcommit_memory=1,然后sysctl -p 使配置文件生效

  vi /etc/sysctl.conf

  修改/添加 vm.overcommit_memory=1

  Esc 退出  :wq 保存

  然后sysctl -p 使配置文件生效

 

posted @ 2019-09-09 10:39  橘子味儿的猫  阅读(19035)  评论(0编辑  收藏  举报