Although we have some minimal tests for detecting leaks in specific areas in our unit tests, we should investigate improvements to our CI in order to better detect retain cycles in the app and safeguard against future memory leaks.
This might include one or more of the following:
New UI or integration tests that leverage either a leak detection library, or utilize some other type of mechanism for monitoring memory usage during typical app user flows and are able to catch and report this error
Note: one challenge here is that some of the tools for catching leaks/retain cycles do not always recognize certain complex cycles. The leak from https://mozilla-hub.atlassian.net/browse/FXIOS-10482 for example was not picked up by either the Leaks or Roots & Cycles tools. However, one option we might explore is to add a simple heuristic for monitoring how memory increases in the app during various repetitive actions (e.g. opening and closing the tab tray).
Adding new unit tests or improving old unit tests to ensure we’re always checking that weak-referenced objects are properly deallocated
Note: in practice, most of our recent retain cycles appear to be things that occur through a combination of UI components interacting in the app during runtime, which is why UI (not unit) tests will probably be the most useful as a safeguard
The iOS client has suffered from several significant memory leaks recently (ex: https://mozilla-hub.atlassian.net/browse/FXIOS-10482 and https://mozilla-hub.atlassian.net/browse/FXIOS-10335).
Although we have some minimal tests for detecting leaks in specific areas in our unit tests, we should investigate improvements to our CI in order to better detect retain cycles in the app and safeguard against future memory leaks.
This might include one or more of the following:
┆Issue is synchronized with this Jira Task