Search code examples
javascriptnode.jsv8jsdom

Memory leaks during readFileSync() in cycle for multiple files


After about 600 parsed files I get memory leaks error.

My source: https://github.com/SageBear/mentorhack/blob/master/src/fl_parser/parse.js

If I use --max-old-space-size v8 node.js flag it works, but become slower and slower...

How to fix that?


Solution

  • The problem was in jsdom - it leaks: https://github.com/jsdom/jsdom/issues/154. After I've replaced it by cheerio, I got what I wanted.