Last active
August 29, 2015 14:04
-
-
Save mctep/1fbf9d099f66d6686dc0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var Promise = require('bluebird'); | |
var fs = require('fs'); | |
var util = require('util'); | |
var memwatch = require('/usr/lib/node_modules/memwatch'); | |
var prReadFile = Promise.promisify(fs.readFile); | |
var _ = require('lodash'); | |
console.log(process.pid); | |
show('start memory:'); | |
fs.readFile('inca-wholesale-8uuCF0.zip', function(buffer) { | |
show('first memory:'); | |
prReadFile('inca-wholesale-kpwmUU.zip').then(function(buffer) { | |
show('second memory:'); | |
}); | |
// fs.readFile('inca-wholesale-kpwmUU.zip', function(buffer) { | |
// show('second memory:'); | |
// }); | |
}); | |
setInterval(function() { | |
console.time('collect'); | |
global.gc(); | |
console.timeEnd('collect'); | |
show('now:'); | |
}, 5000); | |
function show(msg) { | |
console.log(msg, process.memoryUsage().rss / 1024 / 1024); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment