Closed pobrn closed 2 weeks ago
I used sysprof, and that showed one promising candidate for the offending call stack.
In one particular recording about 13.5% of the sampled call stacks were contained the g_signal_emit_by_name()
call inside meta_window_update_monitor()
. And since moving windows between monitors is where I experienced stuttering, I thought it should be something there.
Another sign was that gnome-shell was actually running, it was scheduled on a CPU:
You can see that Meta::Later::invoke()
takes too long, ~175 ms above. That is the part under on_before_update.lto_priv.0
in a particular invocation of the call stack from earlier.
From the call stack, I was quite certain that the issue must be with the window-{left,entered}-monitor
signals. I am not exactly sure how, but I did realize somehow that showing the workspace switcher popup many times will cause the stuttering when moving windows between monitors. So I first tested with this extension disabled, I could not reproduce the issue.
I also modified gnome-shell to print log messages in {Workspace,WorkspaceThumbnail}::_windowEnteredMonitor()
. And from that it seemed that WorkspaceThumbnail
objects were leaked or similar. Then I narrowed it down to the part that shows the workspace popup as when show-popup == false
, the issue disappeared.
Then I started using FinalizationRegistry
to check what is getting leaked, and it became clear that the objects in WorkspaceSwitcherPopup::_items
(the WorkspaceThumbnail
s) do not get finalized. Looking at gnome-shell revealed that they individually .destroy()
every WorkspaceThumbnail
after they are done using them. So I did the same here, and it appears to have solved the issue.
Thanks a lot for the writeup! This will help debugging similar issues in the future.
From the main commit: