Skip to content


Subversion checkout URL

You can clone with
Download ZIP


Memory leak #39

thejh opened this Issue · 4 comments

2 participants


the following code seems to leak (although I'm not sure it's because of your module, maybe the problem is in the core). Below are by attempts to find the cause (however, I didn't find it, but maybe it will help you).

var request = require('request');
var assertVanish = require('./index');

var test = function() {
  var callback = function (error, response, body) {
    if (!error && response.statusCode == 200) {
      console.error("request ok");
    } else {
  assertVanish(callback, 10000);
  request({uri:''}, callback);


Here are the first two hundred lines of a tree that shows why things can't be garbage collected:
Here are most natively-referenced objects (ones that can't get garbage collected although there are no references to them):

Although the network socket got closed (according to lsof) and an answer came in, there are ServerResponse and Agent objects that, in some way, reference the callback provided to request. Doesn't seem right...

Here is the extracted cause for the first encountered natively-referenced thing:


what is ./index.js?


I don't have enough information to debug this. closing for now.

@mikeal mikeal closed this

I'll try to get more info soon.


Oh, sorry, seems like I was mistaken.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.