I have the following code (using node v0.10.0 and Express 3.3.5) which is aimed at serving an mp3 audio file to an http client.
app.get('/media/:id/play', function (req, res) { var file = findById(Number(req.params.id)); if (!file) { return res.send(404); } res.writeHead(200, { 'Content-Type': 'audio/mpeg', 'Transfer-Encoding': 'chunked', 'Connection': 'close' }); var readStream = fs.createReadStream(file.path); res.on('unpipe', function () { res.end(); }); readStream.pipe(res); }); If I start the server and hit the URL in a browser it streams the audio just fine. If I kill the browser I can see that the server socket is closed ($NODE_DEBUG=net,http) and the readStream fires the close event. However, if I open the url in a browser again, the memory on the node process grows a couple MB each time, and never appears to get released. I have studied the API to try to ensure I'm cleaning up properly, but I don't see anything I'm missing -- which is why I'm posting here. What am I doing wrong? -- -- Job Board: http://jobs.nodejs.org/ Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines You received this message because you are subscribed to the Google Groups "nodejs" group. To post to this group, send email to nodejs@googlegroups.com To unsubscribe from this group, send email to nodejs+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en --- You received this message because you are subscribed to the Google Groups "nodejs" group. To unsubscribe from this group and stop receiving emails from it, send an email to nodejs+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.