英文:
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
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论