node-html-parser: Memory leak HTMLElement#text and HTMLElement#rawText

Hey! A strange problem occurred https://youtu.be/TJSj7k4pyHo

I get the text from the element using “node-html-parser” and then pass it to the object.

const root = HTMLParser.parse(content);
let name = root.querySelector(`element`);

If I receive the text directly, then it leads to a memory leak (example in the video, the memory will grow until it leads to an error).

name = name.text;

But if I do the “cloning” then the RAM consumption will be normal.

name = JSON.parse(JSON.stringify(name.text));

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 16 (7 by maintainers)

Most upvoted comments

Hi all. Do we know for certain that this is resolved? If not, I’d like to take a look into it.

“dependencies”: { “node-html-parser”: “^4.1.5” }

Sorry, I forgot to answer. Fixed issue, just ran tests. This request can be closed.