Skip to content

This could lead to memory leak of Promise/PromiseWrap #35

@strawhatboy

Description

@strawhatboy

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions