In each version iteration, the most troublesome step is to detect memory problems. When a large amount of unused memory is inefficiently occupied, it will directly lead to the following two consequences:
- Every time the App enters the background, when the iPhone has insufficient memory and needs to release the App, the App is always released first
- More seriously, it may even crash due to memory problems
There are two traditional solutions:
-
Either you print dealloc from the console to determine which ViewController is unfreed
-
Or use Xcode’s built-in tools to do a memory analysis and figure out where the problem is.
Through analysis, it is found that the most invalid memory occupation is due to the ViewController is not released, and today this article is to provide a new solution to solve the ViewController is not released:
WKVCDeallocMonitor (Applause here… What? Don’t give! I had to impose a BGM palm on myself…)
The edible effect is as follows:
When VC is not released in the project, a clickable view with the word Leak will appear at the top of the screen. After clicking, you can view the list of VC that is not released. Click the Cell corresponding to VC again to view the VC life cycle methods executed in the life cycle before the RELEASE, so as to locate the problem location more easily.
- Now added to Cocoapods Deluxe Lunch:
Add pod ‘WKVCDeallocMonitor’ to your Podfile and then execute pod install. After pod comes down, you can run the project directly and eat it. It only takes effect in DEBUG mode. There won’t be a Leak icon either
For enquiries, please contact [email protected]