trace icon indicating copy to clipboard operation
trace copied to clipboard

Memory leak

Open Sprit3Dan opened this issue 7 years ago • 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 avatar Oct 11 '18 21:10 Sprit3Dan

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

AndreasMadsen avatar Oct 12 '18 07:10 AndreasMadsen

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

AndreasMadsen avatar Oct 12 '18 07:10 AndreasMadsen

@AndreasMadsen, I'm using v8.12.0 LTS

Sprit3Dan avatar Oct 12 '18 10:10 Sprit3Dan

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.

cspotcode avatar Oct 27 '18 18:10 cspotcode