Skip to content

Instantly share code, notes, and snippets.

@lqqyt2423
Created February 26, 2019 02:45
Show Gist options
  • Save lqqyt2423/864be5d3e7fd6309e8dd01e4ea0c3623 to your computer and use it in GitHub Desktop.
Save lqqyt2423/864be5d3e7fd6309e8dd01e4ea0c3623 to your computer and use it in GitHub Desktop.
内存快照,通过chrome开发者工具查看内存快照
'use strict';
// kill -USR2 61365
const heapdump = require('heapdump');
const http = require('http');
const leakArray = [];
const leak = function () {
leakArray.push('leak' + Math.random());
};
http.createServer(function (req, res) {
leak();
res.writeHead(200, { 'Content-Type': 'text/plain' });
res.end('Hello World\n');
}).listen(1337);
console.log('Server running at http://127.0.0.1:1337/');
console.log(`This process is pid ${process.pid}`);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment