Last active
December 10, 2015 20:28
-
-
Save jessetane/4487858 to your computer and use it in GitHub Desktop.
excessive memory usage on large incoming http request?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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