title: NodeJS, PM2, GC, Grafana - better understanding
body: <p>I would like to unterstand the GC Process a little bit better in Nodejs/V8.</p>
  
  <p>Could you provide some information for the following questions:</p>
  
  <ul>
  <li><p>When GC is triggered, does this block the event loop of node js?</p></li>
  <li><p>Is GC running in it's own process or is just a submethod of the event-loop ?</p></li>
  <li><p>When spawning nodejs process via Pm2 (clustered mode) does the instance
  really have it's own process or is the GC shared between the
  instances ?</p></li>
  <li><p>For Logging Purposes I am using Grafana
  (<a href="https://github.com/RuntimeTools/appmetrics-statsd" rel="nofollow noreferrer">https://github.com/RuntimeTools/appmetrics-statsd</a>), can someone
  explain the differences \ more details about these gauges:</p>
  
  <p>gc.size the size of the JavaScript heap in bytes.</p>
  
  <p>gc.used the amount of memory used on the JavaScript heap in bytes.</p></li>
  </ul>
  
  <p><a href="https://i.stack.imgur.com/rG8ha.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/rG8ha.jpg" alt="Memory usage"></a></p>
  
  <ul>
  <li>Are there any scenarios where GC is not freeing memory (gc.used) in relation with stress tests? </li>
  </ul>
  
  <p>The questions are related to an issue that I am currently facing. The used memory of GC is rising and doesn't release any memory (classical memory leak). The problem is that it only appears when we a lot of requests. </p>
  
  <p>I played around with max-old-space-size to avoid pm2 restarts, but it looks like that GC is not freeing up anymore and the whole application is getting really slow...</p>
  
  <p>Any ideas ? </p>