Xcode distribution

Allocation graph

I am running uiautomation scripts in an ios application. After about 40 iterations:

logging in repeatedly pressing several buttons and then exit it

I come to this schedule.

My question is about the distribution schedule. Should it look like this? My script stopped and I think that there are too many memory leaks? I know where the leak is, and it is in the same place all the time. But over time, the distribution chart looks like this? I would suggest that in an ideal storage application that will essentially maintain a slope of 0. But what does this mean for me, which still stands out over time?

Question: should the graph look like this? With the steps that I follow if the memory is freed correctly (not an arc), if it maintains a slanted distribution chart / over time?

+4
source share
2 answers

No, the chart should not look like this. Deductions should usually fall down (with the exception of caches, and even those that should be discarded when they are cleared of memory pressure).

It makes no sense to worry about the distribution, however, until you fix the leak (s). It can do it. Repair the leak and repeat the above exercise and check if the distributions are flat. If not, other problems may arise. But fixing the leak could completely fix the situation.

In addition, if you have not already done so, run the tool through a static analyzer ("Analyze" in the Xcode Product menu or press shift + command + B ). Especially in the MRC code, which identifies many memory management issues. It is like magic. Before proceeding, make sure you have a clean account.

Then use the Leaks tool to pinpoint what is happening. You can then diagnose why this particular object is leaking. Correct this leak before continuing. See the “Leak Detection” section of the “User Guide” section.

Once you have done all this, you can repeat the process of your original question and see if the distributions continue to grow (for example, they may be caused by a save cycle). If you still have problems after fixing the leaks, as described above, there are methods in the tools for determining the type of incremental distributions that you can then use to track any further problems, if any.

For instance:

  • Run the Allocations tool, option -click and drag the distribution tool, and then you can look at the call tree and it will show you what memory consumption. See this answer for an example.

  • Run the Allocations tool. Let the application sink to its resting point. Click the Mark Heap button. Do a bunch of things. Return to the point where you think the material should have been released. Click Mark Heap again. Now look at this heap snapshot and look at the objects that were selected but not released between the two snapshots, and again you can diagnose what is happening.

But all this is a moot point until you fix the leak and the Leaks tool will leak the object more efficiently by the pin point than anything else. Correct it first, and then see where you are standing.

For more information, you can find some of the discussions in a helpful video in the IDC App: memory (especially in the demo sections).

+6
source

Please check if zombies are included in Edit Scheme: Diagnostics. Zombies are never released, and if you run the distribution tool, nothing will ever be deleted.

+1
source

Source: https://habr.com/ru/post/1488346/


All Articles