Memory leak caused by detached nodes after calling Pane.dispose()
Hello there, thank you for your work. Been using your library for a long time.
However, I'm observing a significant memory leak caused by detached Blade DOM elements, even after calling dispose() on their parent Pane:
I followed the instructions here: https://tweakpane.github.io/docs/misc/#disposing.
Reproducing should be fairly simple:
- Start a Chrome Detached Nodes memory trace
- Call
dispose()on a parentPane - End the trace
Let me know if I'm missing something.
Thanks again.
Do you clear the variable for the pane? For example:
window.pane = new Pane();
window.pane.dispose();
this code still retains references to detached nodes because window.pane isn't cleared. To avoid that, set it to null after disposing of the pane:
window.pane = new Pane();
window.pane.dispose();
window.pane = null;
A minimal reproduction environment will help in investigating the issue. You can use tools like CodeSandbox to set up the environment.
Are event handlers also removed when pane.dispose() is called?
window.pane = new Pane();
window.pane.dispose();
window.pane = null;
What if we don't need to delete the pane itself, but need to add new blades?
Hey there, sorry for being away for so long. I don't think I was clearing the variable at the time of posting this, thanks for the advice. I'll re-test this again when I have the time !