https://github.com/naugtur/node-example-heapdump
https://github.com/naugtur/node-example-heapdump
Last synced: 7 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/naugtur/node-example-heapdump
- Owner: naugtur
- License: mit
- Created: 2017-05-19T14:47:19.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2024-10-11T13:35:29.000Z (12 months ago)
- Last Synced: 2025-02-28T23:10:34.612Z (7 months ago)
- Language: JavaScript
- Size: 28.3 KB
- Stars: 15
- Watchers: 2
- Forks: 2
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Heap Snapshot exercise
## Prepare
Before you try the exercises, please run
```
npm install
```*Note, some of the dependencies there are pinned to old versions so that they produce the memory leak you are here to find.*
## Getting a heap snapshot
- Run `npm start`
- Open [http://localhost:8080](http://localhost:8080)
- Now try implementing getting a heap snapshot through a http request and prove a leak exists.
- use: https://nodejs.org/docs/latest/api/v8.html#v8getheapsnapshotoptions## Finding a real issue
Now let's look at a real case of a memory leak. Still a pretty naive one, but one that at least looks realistically.
- Run `npm run real`
- Open [http://localhost:8080](http://localhost:8080)
- Get two heap snapshots
- Find the leak, trace it to a properly named object that you can find, locate the code responsible for leaking (or at least the file).## Spoilers
If you're ready to give up, try again and then look at spoilers.txt