Created
November 9, 2010 16:43
-
-
Save FrankGrimm/669352 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 requestCounter = 0; | |
var startedRequests = 0; | |
var endedRequests = 0; | |
http.createServer(function (request, response) { | |
request.number = requestCounter++; | |
console.log("#" + request.number + " started"); | |
startedRequests++; | |
request.on('end', function() { | |
console.log("#" + request.number + " ended"); | |
endedRequests++; | |
}); | |
response.writeHead(200, {'Content-Type': 'text/plain'}); | |
response.end('Hi there\n'); | |
}).listen(8080); | |
setInterval(function() { | |
console.log("[TOTAL] " + requestCounter + " [S] " + startedRequests + " [E] " + endedRequests + " [S-E] " + (startedRequests - endedRequests)); | |
}, 1000); |
Can't reproduce it with that code either, sorry. Resident memory size goes down again after the GC cleaned up on unused objects here and connections are ended correct. Maybe ask the mailing list if anybody else notices that problem.
Ok thank you very much for your time. I appreciate your help a lot. I will investigate on my side. Maybe it's the "formidable" library I am using.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The following code will cause memory leaks. Can this be avoided?
var http = require('http');
var requestCounter = 0;
var startedRequests = 0;
var endedRequests = 0;
http.createServer(function (request, response) {
request.number = requestCounter++;
}).listen(8008,'192.168.2.95');
setInterval(function() {
console.log("[TOTAL] " + requestCounter + " [S] " + startedRequests + " [E] " + endedRequests + " [S-E] " + (startedRequests - endedRequests));
}, 1000);