theia icon indicating copy to clipboard operation
theia copied to clipboard

The TabsMainImpl class leaks references until group changes

Open dfriederich opened this issue 1 year ago • 3 comments

The TabsMainImpl keeps a list of dispose operations which are 'only' run when a tab group changes. Say if a tab contains 2 elements, and one of them is closed, then that element still remains references, and hence not garbage collected. Only when both elements are removed and a new one is added, then the group is considered changed and the elements are disposed.

https://github.com/eclipse-theia/theia/blob/master/packages/plugin-ext/src/main/browser/tabs/tabs-main.ts#L127 is the code recomputing the model, and in this process the disposables collected in disposableTabBarListeners are disposed. But the code should dispose no longer needed elements as soon as their tab is removed.

dfriederich avatar Sep 19 '24 19:09 dfriederich

@martin-fleck-at so is this one a duplicate that can be closed?

tsmaeder avatar Sep 23 '24 13:09 tsmaeder

@tsmaeder As far as I can tell this is more of a "follow-up" of https://github.com/eclipse-theia/theia/pull/14186

martin-fleck-at avatar Sep 23 '24 13:09 martin-fleck-at

The #14186 fix was fixing that every control was leaked. But this is about that the existing code is only releasing its references in specific circumstances, for example when the first tab gets created, but not when a tab gets closed.

dfriederich avatar Sep 23 '24 16:09 dfriederich