1. Open the tool
Xcode ->product->profile to enter the instruments tool, and then select leaks.
2. Detection
Connect to the real machine, run in instruments, select leaks
It works like this.
This green check mark means normal.
This red cross sign means there is a leak.
Then you can see the leaked method on the left side of the bottom and the call path on the right.
Double-click the method, you can locate the specific code (there is really a leak)
After the code is modified, it needs to be restarted. The above screenshot has actually been repaired, but it has not been restarted, so it will still be leaked.
Fix it at the end.