Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix retain cycles in MXEventListener & MXRoomSummary #1424

Merged
merged 1 commit into from
Mar 29, 2022

Conversation

Johennes
Copy link
Contributor

@Johennes Johennes commented Mar 27, 2022

This is the second part of a fix for a triple-leak involving MXKRoomDataSource, MXRoomEventTimeline and MXEventListener. The first part can be found in element-hq/element-ios#5923.

There are two issues here:

  1. When listening for events on timeline, MXRoomSummary strongly captures the latter in its own event handler block.
  2. The sender property on MXEventListener is strong and, in all cases I was able to locate, the listener is stored in an array on the object that is passed in as sender, creating a retain cycle.

I haven't found concrete steps to reproduce the leak (and the memory graph debugger is also not 100% reliable) but the cycle frequently shows after having entered, left and posted in rooms a few times.

Screenshot 2022-03-27 at 20 31 21
Screenshot 2022-03-27 at 20 30 12

Relates to: element-hq/element-ios#5058

Pull Request Checklist

@pixlwave pixlwave merged commit 18e4d7e into develop Mar 29, 2022
@pixlwave pixlwave deleted the johannes/5058_event_listener_room_summary_leaks branch March 29, 2022 11:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants