This might be a bit of a dumb question. I assume the garbage collector uses any hanging variables after the function completes, but I was wondering if this also applies to DOM fragments.
If I create a DOM fragment or any untethered node, if the garbage collector deletes it after the function finishes execution?
//would this create a memory leak? setInterval(function exampleScope() { var unusedDiv = document.createElement('div'); }, 10);
I know this example is useless, but this is the simplest form of the template I'm worried about. I just want to know that I'm doing the right thing. I worked on creating a very high-performance JavaScript game engine, Red Locomotive . I do not want to add memory leaks.
source share