How can identify strong reference cycles in Swift?

前端 未结 5 1951
无人及你
无人及你 2021-01-30 07:09

Is there a tool or method to locate strong references cycles in my SWIFT code?

A strong reference cycle is when two instances of classes reference each other without

5条回答
  •  野性不改
    2021-01-30 07:41

    You can use Instruments to do that. As the last paragraph of this article states:

    Once Instruments opens, you should start your application and do some interactions, specially in the areas or view controllers you want to test. Any detected leak will appear as a red line in the “Leaks” section. The assistant view includes an area where Instruments will show you the stack trace involved in the leak, giving you insights of where the problem could be and even allowing you to navigate directly to the offending code.

提交回复
热议问题