nodejs net module, streaming data, how to free memory

i'm using net module, opening connection and downloading (streaming) data. code is simple:

connection = net.Socket();
connection.setNoDelay(true);
connection.connect(url.port || 80, url.hostname);
connection.on("connect", function() {
      console.log(process.pid.toString().bold.red + ' connected'.green);
      connection.write(generateRequest(url));
});

memory (buffer) is growing. is there any way to free it?

Node.js uses the Google V8 JavaScript runtime, which is garbage collected, so there is no need to "free memory" by anything other than dropping references to values which are no longer needed.

Specifically, make sure that your code (e.g. the generateRequest(...) function) doesn't retain any collections that grow indefinitely. If you must retain large amounts of data indefinitely (e.g. for logging or statistics) then consider writing them to disk to avoid growing memory indefinitely.