Dummy tab
Reddit front page (A)
\- random reddit post (B)
Ctrl-Shift-T to restore tab B.Ctrl-Shift-T again to restore tab A.Both tabs would have restored correctly with no memory leaks.
Memory usage blows up. Please refer to the screencast:
https://gfycat.com/browndisfigureddrongo
TST sidebar is unresponsive. I can only stop the leaking by closing Firefox.
The first affected TST version is 3.1.3 but somehow I hadn't encountered it until now despite using TST every day...
Is this related to https://github.com/piroor/treestyletab/issues/2340#issuecomment-519464422 ? The last comment seems to suggest the same method to reproduce the memory leak: by closing tabs and reopening them
Possibly I've narrowed down which code triggers the problem. The section https://github.com/piroor/treestyletab/blob/39c8d3ccc3e865c633a750327421ee8e2f2c3036/webextensions/background/tree-structure.js#L275-L286 looks that. After commented out these lines the CPU and memory bloat disappears on my environment.
Finally I've understood why a cyclic reference is produced on such cases.
TST has a function to operate newly opened tabs, and it also has a mechanism to attach such tabs to the active tab based on some configs. But it was not expected to handle any restored ancestor tab, and TST tried to attach a restored ancestor tab to an existing child tab.
Why guard mechanisms for such cyclic references didn't work? Because two operations are triggered on this case asynchronously.
So I've introduced some guards to make TST more safe for such cases. Could you try the latest development build? > all
I cannot reproduce this issue in 3.1.7 anymore. Thanks.
Most helpful comment
I cannot reproduce this issue in 3.1.7 anymore. Thanks.