querySelector APIs Running With Lightning Locker
When Lightning Locker is enabled, components that use
this.template.querySelectorAll APIs to return elements can encounter memory leaks and performance problems with large DOM trees. When the component is removed from the DOM, the memory sometimes isn’t released. Garbage collection doesn’t clear the memory even if you manually invoke garbage collection in DevTools. The browser can use increasing amounts of memory, and potentially crash with an out-of-memory error.
The only work-around for this issue is to enable Lightning Web Security in the org where the component runs. Garbage collection works correctly under LWS.
Alternatively, consider using refs instead of