Skip to content

Avoid holding too many GWeakRefs

Kévin Commaille requested to merge (removed):no-weak-refs into main

GObject uses a singly-linked list to keep track of GWeakRefs to an object. When a GWeakRef is dropped, the list needs to be iterated to find the right one.

In a room with 10k members, it meant two lists of at least 20k GWeakRefs, so dropping them all at once took too much time.

We don't have this issue with strong references, or by using a channel to trigger a method instead of creating GWeakRefs for each member.

This fixes freezes when switching away from big rooms. The UI would freeze for ~1s per 1k members. It was a regression due to dropping the MemberList when we don't need it.

Edited by Kévin Commaille

Merge request reports