2

Here's the Node JS I'm running at the beginning of the script to clear the garbage collector and then logging the available space:

global.gc();
var bytes = process.memoryUsage().rss;
var GB = (bytes / 1073741824).toFixed(5);
g.heapMessage = "MEMORY used in bytes: " + bytes + ", in GB: " + GB + ",  custom message: " + m;

Here's the output to the shell:

JavaScript Extracted

JavaScript Processing
MEMORY used in bytes: 27869184, in GB: 0.02596,  custom message: INIT epochProp
^Z
[7]+  Stopped                 sudo ./runScript
oughtimpliescan1@ubuntu:~$ sudo ./runScript
-bash: fork: Cannot allocate memory
oughtimpliescan1@ubuntu:~$ 

memory fork screenshot

As you can see, there's plenty of memory, 0.02596 GB... and yet the shell keeps telling me it cannot allocate memory, I've tried the 1,2,3 of this command:

sync; echo 1 > /proc/sys/vm/drop_caches

and I'm still having this issue, anybody know what's going on?

dessert
  • 39,982
  • 1
    Also related: https://stackoverflow.com/questions/43652021/bash-fork-cannot-allocate-memory and https://www.linuxquestions.org/questions/linux-server-73/bash-fork-cannot-allocate-memory-4175615868/ – +1 for a well-written question btw, that's how you do it! – dessert Feb 23 '18 at 22:53
  • I've already found these responses, not sure what to do with them as this is happening after a few processes, aka I'll turn off the machine, turn it back on and run a process, it works but then the second or third time it will become clogged by something... I looked at the swap memory but it doesn't make sense that would be the problem... I can try setting ulimit to unlimited for all metrics I suppose... any other ideas? – Jacob Edward Feb 23 '18 at 23:37
  • Could you please open a new question if you have a new or follow-up question? The comment section is not suitable or meant for new questions or extended discussion. You’re welcome to send me a comment with a notification to draw my attention to it. Thanks. – David Foerster Feb 25 '18 at 11:00

0 Answers0