Created
March 24, 2015 04:30
-
-
Save cworsley4/458aa035f97672794e9f to your computer and use it in GitHub Desktop.
Shows the memory leak found in io.js (https://github.com/iojs/io.js/pull/1244)
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 superagent = require('superagent'); | |
var url = 'https://localhost:3000'; | |
var complete = false; | |
var maxReqs = 150; | |
var activeReqs = 0; | |
function run() { | |
console.log('Max [%d] | Active [%d]', maxReqs, activeReqs); | |
if (activeReqs < maxReqs) { | |
activeReqs++; | |
superagent | |
.get(url) | |
.end(function () { | |
console.log('Finished request'); | |
activeReqs--; | |
}); | |
} | |
} | |
setInterval(run, 12); |
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 fs = require('fs'); | |
var https = require('https'); | |
var express = require('express'); | |
var app = express(); | |
app.get('/', function (req, res) { | |
res.send('help world'); | |
}); | |
https.createServer({ | |
key: fs.readFileSync('./key.pem'), | |
cert: fs.readFileSync('./cert.pem') | |
}, app).listen(3000); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment