Skip to content

Instantly share code, notes, and snippets.

@cwholt
Forked from crash2burn/gist:76c840a05416dd394179
Created March 31, 2015 16:56
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 cwholt/a934ef4a7d17e5d92856 to your computer and use it in GitHub Desktop.
Save cwholt/a934ef4a7d17e5d92856 to your computer and use it in GitHub Desktop.
node --expose-gc test.js
var http = require('http')
function Wat() {
this.get = function(cb) {
function callback(response) {
console.log("callback");
}
var req = http.request({
host: "localhost",
port: "5000",
path: "/",
headers: {'Content-Type': 'application/json'},
method: 'GET',
followAllRedirects: true
}, function(res) {
res.on('data', function (chunk) { });
}).end();
}
}
w = new Wat();
setInterval(function() {
w.get(function Werd(res) { })
}, 500)
var mem = 0;
setInterval(function () {
var mem2 = process.memoryUsage().rss;
console.log(mem2,(mem2 - mem));
mem = mem2;
}, 2000)
setInterval(function() {
global.gc();
}, 10000)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment