How IOS memory leaks are detected

Source: Internet
Author: User

How memory leaks are detected:

First, static detection method

1) Manual static detection

Using the Xcode analysis feature, Product->analyze

2) automatic static detection

In the project's build setting, set analyze During ' build ' to Yes

Second, dynamic detection method

1) Instrument Tool detection Leaks

2) Third-party memory detection tools, such as Mleaksfinder

Third, the destruction method Dealloc printing

In general, when creating a project, I will enable analyze During ' build ' in build settings, which will be automatically analyzed at compile time. In this case, after writing a short piece of code, you immediately know if there is a memory leak or other bug problem, and you can fix bugs. In the run process, if exc_bad_access appears, enable nszombieenabled, see if an exception occurs, the console can print more prompt information. If you want to see if there is a memory leak at run time, use the Instrument leak tool. But some memory leaks are hard to check out, sometimes only by manually overwriting the Dealloc method to see if it eventually has no call.

How IOS memory leaks are detected

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.