forge icon indicating copy to clipboard operation
forge copied to clipboard

Possible Memory Leak: Detached <div> and MutationObservers Referenced in node-forge

Open last-Programmer opened this issue 1 month ago • 3 comments

Hi,

I am currently investigating potential memory leaks in our application. During analysis in Chrome DevTools (Memory tab), I noticed a detached

node appearing in the “Detached Elements” section. Tracing the reference chain points to /lib/util.js: Image

I also observed that MutationObserver instances are referenced from util.js.

Could you please clarify whether it is expected for node-forge to have detached DOM nodes and active MutationObserver references, or if this may indicate an issue?

Thank you.

last-Programmer avatar Nov 26 '25 15:11 last-Programmer

It probably shouldn't leak memory. That code is rather ancient and likely working around issues in JS runtimes from 10-15 years ago. The techniques used there might be obsolete today.

davidlehn avatar Dec 02 '25 19:12 davidlehn

Thanks for the reply. I am not saying it is leaking. the detach div always stay in memory. it is not being removed after the invoking the methods in the library.

last-Programmer avatar Dec 04 '25 17:12 last-Programmer

Ah. I'm not sure how that code works anymore. If we modernize all the code, will have to look at dealing with these sorts of issues. If you have insights on what should change or is not needed, please share.

davidlehn avatar Dec 05 '25 02:12 davidlehn