Tips for solving arc Memory leakage and arc Memory leakage
Be sure to note that when running the app, We must care about the memory usage and try not to exceed20 M,Even if many images are to be displayed, they cannot exceed30 M. Therefore, it is a good habit to focus more on memory usage when running apps developed by myself.
For performance and memory optimization, this involves too much. Now let's talk about several common solutions to memory leakage.
1. instruments
Instrument can report a lot of memory leakage errors. The method is http://www.cocoachina.com/ios/20141203/10519.html, which is easy to operate.
However, its biggest function is to see where the memory is used more and optimize it.
2. arc Problems
ARC does not manage C-types, of which CGImage may be considered. You must release the ref manually when you are finishedCGImageRelease (image );
This is the answer from stackoverflow, that is, in arc mode, the C-types object needs to be manually released.
Arc also has issues such as loop reference, which prevents objects from being released. You can write-(void) dealloc to set breakpoints. If the page does not jump, this proves that you have made a mistake. If the automatic count is not 0, it will not be released, the memory will continue to increase, and you need to find the error.
3. image suggestions
Many images need to be loaded. Do not store images in the queue. Either the image exists in the sandbox, the address in the queue, or the thumbnails in the queue are stored. Click the image and zoom in again.
The most undesirable method is to have a clear big image. You may need to reduce the size of the Image view, which is very memory-consuming.