Create a gist now

Instantly share code, notes, and snippets.

@spollack /leak.js
Last active Dec 12, 2015

What would you like to do?
var zlib = require('zlib');
var iteration = 0;
var maxRss = 0;
(function leak() {
if (iteration % 1000 === 0) {
var usage = process.memoryUsage();
maxRss = Math.max(maxRss, usage.rss);
console.log('MEMORY USAGE current: ' + JSON.stringify(usage) + '; max rss: ' + maxRss + '; iteration: ' + iteration);
}
iteration++;
zlib.gzip('this is some test data', function() {
process.nextTick(leak);
});
})();
@spollack

This comment has been minimized.

Show comment Hide comment
@spollack

spollack Feb 5, 2013

This gist demonstrates a bad behavior of zlib, where RSS will grow to very high levels rapidly. in my tests, within a handful of seconds RSS is well over 500MB. This repros on node 0.8.18. It is fixed in 0.9.8.

Owner

spollack commented Feb 5, 2013

This gist demonstrates a bad behavior of zlib, where RSS will grow to very high levels rapidly. in my tests, within a handful of seconds RSS is well over 500MB. This repros on node 0.8.18. It is fixed in 0.9.8.

@spollack

This comment has been minimized.

Show comment Hide comment
@spollack

spollack Feb 5, 2013

Owner

spollack commented Feb 5, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment