Skip to content

Commit

Permalink
WorkspaceSwitcherPopup: destroy WorkspaceThumbnail objects
Browse files Browse the repository at this point in the history
WorkspaceThumbnail objects must be explicitly destroy()ed, otherwise
they will not be garbage collected. Furthermore, each such object
subscribes to the "window-{left,entered}-monitor" signal of the
particular MetaDisplay. Thus leaking these thumbnails causes those
signals to have a very large number of subscribers after the popup
has been shown a sufficient number of times. This shows up in profiling,
and also causes stuttering when a window is moved between monitors or created.

For example, with 4*4=16 workspaces on 3 monitors, every time the popup
is shown 48 new subscribers are added to both signals. After a couple
days of uptime, there may be thousands.

Fix that by destroying the WorkspaceThumbnail objects in `_onDestroy()`.
  • Loading branch information
pobrn committed Nov 4, 2024
1 parent 5b63242 commit 92d1e6c
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions [email protected]/workspacePopup/workspaceSwitcherPopup.js
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,9 @@ class WorkspaceSwitcherPopup extends SwitcherPopup {
while (modals.length > 0) {
modals.pop().destroy();
}

this._items.forEach((x) => x.destroy());
this._items = [];
}

vfunc_allocate(box) {
Expand Down

0 comments on commit 92d1e6c

Please sign in to comment.