basic_heapdiff.js 279 B

1234567891011121314151617181920212223
  1. const
  2. memwatch = require('..'),
  3. url = require('url');
  4. function LeakingClass() {
  5. }
  6. memwatch.gc();
  7. var arr = [];
  8. var hd = new memwatch.HeapDiff();
  9. for (var i = 0; i < 10000; i++) arr.push(new LeakingClass);
  10. var hde = hd.end();
  11. console.log(JSON.stringify(hde, null, 2));