title: Increasing memory size of node.js doesn't take affect
body: <p><strong>My use case</strong>    </p>
  
  <ul>
  <li>I have a Linux server which runs node.js 8 version</li>
  <li>The purpose of this node is to collect external workers array and compose them into 1 big response </li>
  <li>flushing the response to the network.</li>
  </ul>
  
  <p><strong>My Problem</strong><br>
  I'm running at some point out of memory heap and my process breaks. This is the error I'm getting</p>
  
  <blockquote>
    <p>1|proxy  | &lt;--- Last few GCs ---><br>
    1|proxy  | [11552:0x4063010]   143107 ms: Scavenge 4416.2 (4694.3) -> 4401.6 (4694.3) MB, 4.0 / 0.0 ms  allocation failure<br>
    1|proxy  | [11552:0x4063010]   143373 ms: Scavenge 4416.2 (4694.3) -> 4401.7 (4694.3) MB, 4.2 / 0.0 ms  allocation failure<br>
    1|proxy  | [11552:0x4063010]   143639 ms: Scavenge 4416.2 (4694.3) -> 4401.6 (4694.3) MB, 4.1 / 0.0 ms  allocation failure<br>
    1|proxy  | [11552:0x4063010]   143904 ms: Scavenge 4416.2 (4694.3) -> 4401.6 (4694.3) MB, 3.6 / 0.0 ms  allocation failure<br>
    1|proxy  | &lt;--- JS stacktrace ---><br>
    1|proxy  | ==== JS stack trace =========================================<br>
    1|proxy  | Security context: 0x31ced5525ee1 
    1|proxy  |     1: _callee37$ [/StackData/bd/tools/proxy/server.js:~3482]<br>
       [pc=0x22e6d2a49018](this=0x1b549e48b339 ,_context37=0x325a9be822f1 )
    1|proxy  |     3: tryCatch(aka tryCatch) [/StackData/bd/node_modules/babel-polyfill/node_modules/regenerator-runtime/runtime.js:65] [bytecode=0x170c5857ef81 offset=15](this=0x3b92b1582311<br>
    ,fn=0x325a9be82201 &lt;...<br>
    <b>1|proxy  | 24-05 11:53:52.997: FATAL ERROR: invalid array length Allocation failed - JavaScript heap out of memory</b></p>
  </blockquote>
  
  <p><strong>What I tried so far</strong></p>
  
  <ul>
  <li>I verified using <code>process.memoryUsage()</code> what's my heap size before the error 
  
  <blockquote>
    <p>memory at: {"rss":5161619456,"<b> heapTotal":4920782848</b>,"heapUsed":4615629928,"external":10992199}</p>
  </blockquote></li>
  <li>I added to my start script this configuration <code>--max_old_space_size=8192</code> but it doesn't help, As can be seen from the previous log print, This is the full start command:<br>
  <code>/usr/bin/pm2 --log-date-format 'DD-MM HH:mm:ss.SSS' -x -i 1 start node --node-args="--max_old_space_size=8192 -r babel-register" /StackData/bd/tools/proxy/proxy.js</code></li>
  <li>Confirmed I'm using node 8.9.4 version using <code>node --version</code></li>
  <li>I checked some SO answer, <a href="https://stackoverflow.com/q/54594610/1031958">this one for example</a>, but I found no better ideas</li>
  </ul>
  
  <p>Any ideas what else I can do?</p>