Skip to content

Instantly share code, notes, and snippets.

@jessetane
Last active December 10, 2015 20:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jessetane/4487858 to your computer and use it in GitHub Desktop.
Save jessetane/4487858 to your computer and use it in GitHub Desktop.
excessive memory usage on large incoming http request?
var http = require('http')
var PORT = 8080
// watch mem usage
setInterval(function () {
console.log('memory usage ' + (process.memoryUsage().rss / (1024 * 1024)).toFixed(2) + 'mb')
}, 500)
http.createServer(function (req, res) {
console.log('- got request')
setTimeout(function () {
console.log('- didn\'t read')
req.destroy()
res.end()
}, 1000)
}).listen(PORT, function () {
console.log('server listening on ' + PORT)
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment