Memory leak in `_contexts`
See original GitHub issueWe upgraded to Node 8 yesterday, and are now seeing memory leaks. Taking some heap snapshots I can see the _contexts
map growing all the time. We run 4.2.2, so it shouldn’t be the memory leak fixed recently.
It’s hard to follow the code, but I would guess this is related to how the promises are handled. At least it seems the contexts are not always removed from the map.
Issue Analytics
- State:
- Created 6 years ago
- Comments:6 (1 by maintainers)
Top Results From Across the Web
Context and memory leaks in Android - Medium
Learning to properly manage the Context is an skill that will save us from unexpected problems and that is closely linked with memory...
Read more >Android : References to a Context and memory leaks
I've read that it is a mistake and a source of memory leaks in Android application to keep a long-lived references to a...
Read more >Everything You Need To Know About Context-Related ...
Everything You Need To Know About Context-Related Memory Leaks In Android · Step #1. It traverses all the objects from GC roots and...
Read more >Memory Leaks in Android: Find, Fix, and Avoid
1. You should not: Avoid using static variables for views or context-related references. Pass a context-related reference to a Singleton class. Improperly use...
Read more >Context- and Path-sensitive Memory Leak Detection∗
We present a context- and path-sensitive algorithm for de- tecting memory leaks in programs with explicit memory management. Our leak detection algorithm is ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
We eventually worked out what was causing this. Turned out to actually be the NewRelic that was the main culprit, albeit we also had some of our own.
The fact that the contexts are only destroyed when the promise is garbage collected, requires you to be very careful that you do not in some indirect way reference the promises from the data you store in the cls.
Hum, seems like, it is a normal behavior in this issue https://github.com/nodejs/node/issues/14446#issuecomment-317673776
so maybe this issue here is OK too.