AndreasMadsen/trace

Memory leak

Opened this issue · 4 comments

Memory leak!

Hello!
Not sure if it is done on purpose, and it is by-design, but I encountered a huge memory leak using your library with express.js.

I created a tiny PoC for you to check it out. https://github.com/Sprit3Dan/mem-leak

The way it could be reproduces is to make the callback for the express path asynchronous by adding the async keyword.

Here are the charts for heap used per ~1k queries.

If you add the library:

image

If not:

image

Guess many people could be stuck at this situation, when using you lib.
Hope you find this ticket useful :)

@Sprit3Dan Thanks you so much. Similar issues have been reported before, but I couldn't get a simple test case.

@Sprit3Dan Just to be safe, what version of node.js are you using?

@AndreasMadsen, I'm using v8.12.0 LTS

I see the memory leak on v8.12.0 but not on v10.11.0. This might be a node bug, considering that async_hooks was a preview feature in node 8.