| OLD | NEW |
| (Empty) | |
| 1 if (process.execArgv[0] !== "--expose-gc") { |
| 2 console.error("please run with node --expose-gc"); |
| 3 process.exit(1); |
| 4 } |
| 5 |
| 6 var async = require("../"); |
| 7 global.gc(); |
| 8 var startMem = process.memoryUsage().heapUsed; |
| 9 |
| 10 function waterfallTest(cb) { |
| 11 var functions = []; |
| 12 |
| 13 for(var i = 0; i < 10000; i++) { |
| 14 functions.push(function leaky(next) { |
| 15 function func1(cb) {return cb(); } |
| 16 |
| 17 function func2(callback) { |
| 18 if (true) { |
| 19 callback(); |
| 20 //return next(); // Should be callback here. |
| 21 } |
| 22 } |
| 23 |
| 24 function func3(cb) {return cb(); } |
| 25 |
| 26 async.waterfall([ |
| 27 func1, |
| 28 func2, |
| 29 func3 |
| 30 ], next); |
| 31 }); |
| 32 } |
| 33 |
| 34 async.parallel(functions, cb); |
| 35 } |
| 36 |
| 37 function reportMemory() { |
| 38 global.gc(); |
| 39 var increase = process.memoryUsage().heapUsed - startMem; |
| 40 console.log("memory increase: " + |
| 41 (+(increase / 1024).toPrecision(3)) + "kB"); |
| 42 } |
| 43 |
| 44 waterfallTest(function () { |
| 45 setTimeout(reportMemory, 0); |
| 46 }); |
| OLD | NEW |