IOS uses instruments's leaks tool to find memory leaks in specific locations

Source: Internet
Author: User

Encounter this similar [xx retain]: message sent to deallocated instance, the problem.

Using the method (Command + Shift + B) to analyze the memory leaks is no longer sufficient.

Using instruments's leaks tool to detect memory leaks during app runs can save you a lot of development costs.

The steps are as follows:


The shortcut key (Command + Control + I) directly brings up the instruments tool, such as (inside the red box):

After selection, the display interface is as follows:

The above is the preparatory work, the next start debugging.

1. Select Xcode and use the shortcut key (Command + R) to keep the simulator running;

2. Select Xcode, shortcut key (Command + Control + I), let leaks in the running state;

3.leaks is dynamic monitoring, we need to manually operate the app while observing leaks changes;

Where a red Cross or red pillar appears, that is the location of the memory leak detected;

Click on the top left corner of the second button (in the Circle box), you can pause detection, you can continue to detect, there are multiple leaks, one-time processing;

4. Select the ① arrow Leaks, then select the ② arrow, select the 3 location call Tree, and then modify the 4 position settings

5. Select a row to jump to the problem code.

IOS uses instruments's leaks tool to find the exact location of the memory leak

Related Article

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: 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.