ARC-Xcode detection cycle reference, and arc-xcode detection reference
1. Create a project on the desktop and enter the following code in ViewController. m:
- (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view, typically from a nib. NSMutableArray *firstArray=[[NSMutableArray alloc]init]; NSMutableArray *secondArray=[[NSMutableArray alloc]init]; [firstArray addObject:secondArray]; [secondArray addObject:firstArray]; }
After the code is added, the project file is shown in:
2. Select the Product -----> Profile -------> Project simulator to start running, as shown in:
3. In the pop-up dialog box, select Leaks ----> Choose.
4. After Choose is selected, the following page is displayed. Allocations is selected by default.
5. Select Leaks.
6. Select the Red Circle in the upper left corner. The red circle turns into a square shape. At this point, start running the project and check for circular references.
7. The following interface is displayed.
8. Click the black circle and the circle turns red again. The cyclic reference detection is stopped temporarily.
9. loop detection is completed. A red line appears in Leaks, indicating a memory leak.
References: iOS development advanced-Tang Qiao