无法分配内存错误

huangapple go评论106阅读模式
英文:

cannot allocate memory error

问题

我刚刚将我的应用程序从Python迁移到Go,所以对Go还有点陌生。看起来我遇到了内存问题。在Ubuntu机器上通过supervisor运行时出现了getAudioOnlyInfo: fork/exec /usr/local/bin/youtube-dl: cannot allocate memory的错误。

编辑:

通过设置sysctl -w vm.swappiness=1解决了这个问题。

英文:

I just ported my app over from python so I'm a bit new to Go. It seems I am having a memory issues. getAudioOnlyInfo: fork/exec /usr/local/bin/youtube-dl: cannot allocate memory.

This is run on a ubuntu machine. Via supervisor.

Edit:

setting the sysctl -w vm.swappiness=1 resolve the issue

答案1

得分: 6

对于遇到这个问题的其他人,这是一个相关的最近问题在golang问题中

> 对于所有受影响的人,在修复问题之前,在Linux上的临时解决方法可以是以下之一:
>
> 1. 启用无条件的过度承诺:sysctl -w vm.overcommit_memory=1
> 2. 启用无条件的过度承诺:sysctl -w vm.overcommit_memory=1 在主机上添加交换空间,使用sysctl -w vm.swappiness=1它几乎不会被使用,但它参与计算,当Linux内核决定是否能够满足分配时,default overcommit_memory=0被使用

英文:

For anyone else who runs into this problem, it was a related recent issue in the golang issue

> For all those affected, temporary workaround on Linux until it is
> fixed properly can be one of following:
>
> 1. enable unconditional overcommit: sysctl -w vm.overcommit_memory=1
> 2. enable unconditional overcommit: sysctl -w vm.overcommit_memory=1 add swap to your host, with sysctl -w vm.swappiness=1 it will almost
> never going to be used, but it participates in calculations where
> Linux kernel decides to whether it can afford to satisfy allocation or
> not when default overcommit_memory=0 is in use

huangapple
  • 本文由 发表于 2016年1月27日 06:32:45
  • 转载请务必保留本文链接:https://go.coder-hub.com/35025338.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定