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 GoalViewController memory leak #591

Merged
merged 3 commits into from
Dec 31, 2024
Merged

Fix GoalViewController memory leak #591

merged 3 commits into from
Dec 31, 2024

Conversation

theospears
Copy link
Collaborator

@theospears theospears commented Dec 31, 2024

Summary

We were retaining references to GoalViewController meaning it was not correctly cleaned up when leaving the view. There were two causes of this.

  1. A reference cycle between GoalViewController and DatapointTableController (fixed via weak ref)
  2. A Timer maintaining a reference to the view (fixed via invalidating the timer on hide).

Fixes #590

Validation

Ran the app in the simulator. Navigated to the goal view and back several times. Ran the XCode memory graph debugger.
Before this patch: Observed many GoalViewController still in memory
After this patch: No copies of the class in memory

Logged out and logged into the app. Observed there was no longer a crash reading goal objects.

Copy link
Collaborator Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

@theospears theospears changed the title Remove cycles from GoalViewController Fix GoalViewController memory leak Dec 31, 2024
@theospears theospears marked this pull request as ready for review December 31, 2024 05:43
@theospears theospears requested a review from a team as a code owner December 31, 2024 05:43
@theospears theospears merged commit 242313f into master Dec 31, 2024
6 checks passed
@theospears theospears deleted the unregister-views branch December 31, 2024 17:36
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.

GoalViewController crashes when logging out and then logging in again
2 participants