Skip to content

Instantly share code, notes, and snippets.

@lovell
Created September 23, 2014 13:03
Show Gist options
  • Save lovell/f79476202c6cb9533f8e to your computer and use it in GitHub Desktop.
Save lovell/f79476202c6cb9533f8e to your computer and use it in GitHub Desktop.
var exec = require('child_process').exec
var async = require('async');
var sharp = require('sharp');
sharp.cache(0);
var tasks = 0;
console.log('RSS: ' + process.memoryUsage().rss);
async.whilst(
function() {
return tasks < 10000;
},
function(callback) {
sharp('input.jpg').resize(300, 200).toFile('output.jpg', function(err) {
tasks++;
callback(err);
});
},
function(err) {
if (err) {
throw err;
}
console.log('RSS: ' + process.memoryUsage().rss);
exec('cat /proc/pagetypeinfo', function (err, stdout, stderr) {
console.log(stdout);
});
}
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment