title: Why does Node.js have incremental memory usage?
body: <p>I have a gameserver.js file that is well over 100 KB in size. And I kept checking my task manager after each refresh on my browser and kept seeing my <code>node.exe</code> memory usage keep rising for every refresh. I'm using the <code>ws</code> module here: <a href="https://github.com/websockets/ws" rel="nofollow noreferrer">https://github.com/websockets/ws</a> and figured, you know what, there is most likely some memory leak in <strong>my</strong> code somewhere...</p>
  
  <p>So to double check and isolate the issue I created a <code>test.js</code> file and put in the default <code>ws</code> code block:</p>
  
  <pre><code>var WebSocketServer = require('ws').Server
    , wss = new WebSocketServer({ port: 9300 });
  
  wss.on('connection', function connection(ws) {
    ws.on('message', function incoming(message) {
      console.log('received: %s', message);
    });
  });
  </code></pre>
  
  <p>And started it up:</p>
  
  <p><img src="https://i.stack.imgur.com/Gc8OO.png" alt="Enter image description here"></p>
  
  <p>Now, I check <code>node.exe</code>'s memory usage:</p>
  
  <p><img src="https://i.stack.imgur.com/g6sJ2.png" alt="Enter image description here"></p>
  
  <p><strong>The incremental part that makes me confused is:</strong></p>
  
  <p>If I refresh my browser that makes the connection to this port <code>9300</code> websocket server and then look back at my task manager.. it shows:</p>
  
  <p><img src="https://i.stack.imgur.com/4JASz.png" alt="Enter image description here"></p>
  
  <p>Which is now at: <strong><code>14,500 K</code></strong>.</p>
  
  <p>And it keeps on rising upon each refresh, so theoretically if I keep just refreshing it will go through the roof. Is this intended? Is there a memory leak in the <code>ws</code> module somewhere maybe? The whole reason I ask is because I thought maybe in a few minutes or when the user closes the browser it will go back down, but it doesn't.</p>
  
  <p>And the core reason why I wanted to do this test because I figured I had a memory leak issue in my personal code somewhere and just wanted to check if it wasn't me, or vice versa. Now I'm stumped.</p>