This project is to demonstrate a leak and how to fix it with proper teardown. It is based on https://techtldr.com/simple-guide-to-finding-a-javascript-memory-leak-in-node-js/
First run npm run leak
w/out options, and finish the steps to see the leak chart.
Then run it again with the flags to see the fix.
npm i
npm run leak
npm run leak -- --fixed
(fix the leak)npm run leak -- --clean
(clean heapdump files)npm run leak -- --fixed --clean
(fix the leak, clean heapdump files)
ctrl+c
npm run server
- Navigate browser to http://localhost:3000
- Observe the leak chart of memory over time
- If no --fixed flag you'll see up and to the right
- if --fixed flag you'll see it flatten out and maintain
NOTE: If you run npm run leak
and then npm run leak again
it'll stack. So you will see ALL of the heapdumps over time even after you run npm run leak -- --fixed
.