goubuntu-14.04

cannot allocate memory error


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


Solution

  • 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. 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