moved here
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"), | |
url = require("url"), | |
path = require("path"), | |
fs = require("fs") | |
port = process.argv[2] || 8888; | |
http.createServer(function(request, response) { | |
var uri = url.parse(request.url).pathname | |
, filename = path.join(process.cwd(), uri); |
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
node --expose-gc leak.js | |
webkit-devtools-agent started on 0.0.0.0:1337 | |
We should do 18 requests | |
3MB used | |
Done: 0/18, not yet GC: 0 | |
Got error: undefined | |
Got error: undefined | |
Got error: undefined | |
Got error: undefined | |
Got error: undefined |
http.get + req.on('error', function(){})
seems to provoke a memory leak:
node --expose-gc leak.js
We should do 5 requests
2MB used
Done: 0/5, not yet GC: 0
26MB used
Done: 5/5, not yet GC: 5
all requests done, memory should be collected by now ?
26MB used
I am actually playing on the branch https://github.com/joyent/node/tree/http-memleak
Without setTimeout it works like a charm,
node --expose-gc gistfile1.js
webkit-devtools-agent started on 0.0.0.0:1337
We should do 18 requests
3MB used
Done: 0/18, not yet GC: 0
Got error: socket hang up
An other memory leak with socket hang up
# node --expose-gc leak.js
webkit-devtools-agent started on 127.0.0.1:1337
We should do 18 requests
3MB used
Done: 0/18, not yet GC: 0
Got error: socket hang up
Got error: socket hang up
Got error: socket hang up
Without doing a DOS on Google it still leaks:
[romain@myhost trace-memory-leaks]$ node --expose-gc gistfile1.js
We should do 5 requests
3MB used
Done: 0/5, not yet GC: 0
24MB used
Done: 5/5, not yet GC: 5
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
(function () { | |
'use strict'; | |
var vows = require('vows'), | |
assert = require('assert'); | |
vows.describe('some test').addBatch({ | |
'test level 1': { | |
topic: function () { | |
this.callback(null, 1); |
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
yum install sudo man unzip curl gcc-c++ screen rpm-build gettext-devel | |
mkdir -p /usr/src/redhat/SOURCES | |
mkdir -p /usr/src/redhat/SPECS | |
curl -sR -o /usr/src/redhat/SPECS/tar.spec https://raw.github.com/gist/1241902/tar.spec | |
curl -sR -o /usr/src/redhat/SOURCES/tar-1.26.tar.bz2 ftp://ftp.gnu.org/gnu/tar/tar-1.26.tar.bz2 | |
rpmbuild -ba /usr/src/redhat/SPECS/tar.spec |
NewerOlder