Skip to content

Instantly share code, notes, and snippets.

@elliotttf
Created January 6, 2012 19:59
Show Gist options
  • Save elliotttf/1572145 to your computer and use it in GitHub Desktop.
Save elliotttf/1572145 to your computer and use it in GitHub Desktop.
Memory leak plugged
diff --git a/lib/pubhub.js b/lib/pubhub.js
index 1878e96..9d22ab8 100644
--- a/lib/pubhub.js
+++ b/lib/pubhub.js
@@ -152,6 +152,11 @@ PubHub.prototype.fetch = function(options) {
console.log('New data found on %s.', feedString);
self.emit('changed', data);
}
+
+ // Explicitly null out the data so it doesn't hang around after we're
+ // done with it.
+ data = null;
+ res = null;
});
});
@@ -234,6 +239,8 @@ PubHub.prototype.publishOne = function(subscriber, data) {
else {
console.log('Published %s to %s.', feedString, subscriberString);
clearInterval(retryId);
+ retry = null;
+ res = null;
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment