How to "free" memory Buffer from Garbage Collector in Node.js?
<p>I want to know how I can destroy a Buffer in order to free memory.<br>
I have the code below, it creates a Buffer and send this one as response. This works fine but when I play with a big array like with 75 000 rows, I can see my memory takes over 1Go, it's ok but when the response is sent, this memory is kept and not free... I try to set <code>var buffer</code> to <code>null</code> at the end of the script but nothing append... Is there a solution to free this memory ?   </p>

<pre><code>var xlsxexport = require('node-xlsx');

module.exports = {
    exportExcel: function (req, res) {

        var excelData = []
        // ...
        // Construction of the array excelData
        // ...

        var buffer = xlsxexport.build([{name:'export', data:excelData}])
        res.set 'Content-Type', 'application/vnd.openxmlformats'
        res.set 'Content-Disposition', 'attachment; filename=' + filename
        res.send buffer
  }
}
</code></pre>