Hello guys,
I was using this module to track what is pending in my nodejs project, and once my node process ended with heap out of memory, I was confused a lot by checking my code for memory leak...
Finally with ChromeDev tools, I found that the objects Array, Promise & PromiseWrap were always increasing without being released by GC, and they're somehow related to this module.
By checking the source code, async-hook was used to track all the Promises/async/await, and they're put into a map... so I think that's where the leak happens. and after removed require('why-is-node-running') from my code, the memory leak was gone.
So maybe I would like to recommend to put some WARNINGS in the README.md file of this module like:
if you're creating new Promises to wrap traditional callbacks a lot, this module could lead to memory leaks...
Thanks.
Hello guys,
I was using this module to track what is pending in my nodejs project, and once my node process ended with heap out of memory, I was confused a lot by checking my code for memory leak...
Finally with ChromeDev tools, I found that the objects Array, Promise & PromiseWrap were always increasing without being released by GC, and they're somehow related to this module.
By checking the source code,
async-hookwas used to track all the Promises/async/await, and they're put into a map... so I think that's where the leak happens. and after removedrequire('why-is-node-running')from my code, the memory leak was gone.So maybe I would like to recommend to put some WARNINGS in the
README.mdfile of this module like:if you're creating new
Promisesto wrap traditional callbacks a lot, this module could lead to memory leaks...Thanks.