Proved the Retain-cycle caused to Memory-leak in Closure and Delegate
Part1. Closure
To prove that using a closure will result in retain cycle, I created a simple model: a ViewController (VC1), and a custom DetailViewController class (VC2) will pass the information to the VC1 through the closure, and switch to another ViewController (VC3)
Also I want to confirm if the DetailViewController will disappear in the memory, because if it does not disappear, it means that VC1 and VC2 are strongly connected to each other, causing the memory leak.
To figure out the location of the variable in memory:
Although the data from the DataModel can be obtained normally, the VC2 has not disappeared and remains in the memory. It can be seen from the tool that Memory Leak has been caused.