isaacs / node-graceful-fs

fs with incremental backoff on EMFILE
ISC License
1.27k stars 148 forks source link

Memory leak when loaded with different globals #183

Closed SimenB closed 4 years ago

SimenB commented 4 years ago

The current check looks for a Symbol (or a string on older nodes) on global, which fails when the module is evaluated in different contexts, like what Jest does.

I've put together a repository which is too small to really show the leak, but it illustrates what the issue is: https://github.com/SimenB/graceful-fs-jest-memleak

If we just log when fs is patched, this is the result:

image

If we add the queue to fs instead of global, this is the result:

image

kirillgroshkov commented 4 years ago

Cannot upvote enough!