We've been experiencing memory leaks since updating from cheerio 0.19 to 0.20. Rolling back a version solved the problem. I've been unable to identify the exact cause, but here are some application and environment details:
Let me know if you need any more details

+1
was struggling a lot with the memory issue and rolling back to 0.19 gave me a big relief.
Confirm the problem. Downgraded to 0.19 and seems to be working so far.
@wheresrhys Is there any way we can modify the code so this problem happen faster? That way we can get all the commits from version 0.19 and 0.20 and test it one by one and find where the problem is
Some stacktrace
==== JS stack trace =========================================
Security context: 0x2ddda71b4629
1: substring(aka substring) [native string.js:~483] [pc=0x1662d7b14163](this=0xf35810aad092: _parse [/home/ubuntu/www/survarium-api/server/v2/node_modules/cheerio/node_modules/htmlparser2/lib/Tokenizer.js:~635] [pc=0x1662d706a0f0](this=0xf35
810b3fc1 3: parseDOM [/home/ubuntu/www/survarium-api/server...
FATAL ERROR: Committing semi space failed. Allocation failed - process out of memory
The memory leak was only really apparent in production under heavy load and I can't really justify attempting to recreate the bug again I'm afraid
Have a same problem. I'm downgraded to 0.19.
Have the same problem
I have a same problem. In heap snapshot, i see, that all my variables with text from cheerio, is "sliced string" which contain all html page. I`m use dirty (but working) solution
function unleak(s) {
return (' ' + s).substr(1);
}
for all my values from cheerio. It eliminate memory leaks.
This issue remains true for me as well. Really wrecks production. I advise remaining on 0.19 for anyone on the fence still.
had same issue, this from above worked a treat for me
function unleak(s) {
return (' ' + s).substr(1);
}
Fixed on the 1.0.0-RC versions.
Most helpful comment
Have the same problem