The ambiguity of using iOS development tools

I profile the application with tools. Profiling is performed using the Separation tool in two ways:

  • Selecting Directly Allocations when starting the profiling application
  • Selecting leaks when I run the profiling application.

In both cases, I had an Allocations testing tool. But surprisingly, in these cases, I had two different types of Out for Allocations.

Should they behave differently? or is it a problem with the tools.

Time I Profile with a leak tool:

In the distribution graph: enter image description here 1. I get many peaks in the graph, real-time bytes and common bytes are the same. 2. I get black flags (I think it warns of a memory warning) after 1 minute of use. Then, after a set of flags appears, my application crashes. (This happens sometimes, even when you directly launch the application on the device)

Time I Profile using the selection tool:

In the distribution graph: enter image description here 1. I often do not get peaks, as in the above case. Live bytes have always been less than shared bytes. 2. I used more than 20 minutes and never received black flags.

One of the facts I learned is that when Live bytes and shared bytes are equal, NSZombieEnabled can be enabled.

Have any of you ever had this problem.

UPDATE 1:

I had another problem with the first case. Whenever I was profiling after a short duration (compared to profiling in the second case), the application received a lot of black flags and my application crashed. (Due to memory warning)

And when I tried a similar step-by-step use of the application, my application did not work and did not receive any flags.

Why is this a mismatch?

+6
source share
2 answers

In the first case, you track only direct distributions, because the Leakage template sets up the Distributions tool this way. Secondly, you track both direct and freed distributions. (As CocoaFu said).

Both are useful, but for several reasons.

Only direct distribution tracking (combined with Heapshot analysis, as a rule) is a great way to analyze the constant heap growth in your application. Once you know what sticks out forever, you can understand why and see if there are ways to optimize it.

Tracking all distributions, living and dead, is a very effective means of tracking bandwidth. You can sort by common bytes and start with the largest #. Look at all the selection points (click the small arrow next to the label in the category of the selected row) and see where all the distributions come from.

For example, your graph shows that during this period there are 1.27 MB of 14 byte allocations - 9218 distributions. Everyone was free () d [good!], But it still represents a ton of work to distribute, populate the data (presumably), and free each one. This may be a problem, maybe not.

(To put it in perspective, I used this method to optimize the application. By simply focusing on reducing # transient short circuits, I was able to make the primary application algorithms faster and reduce memory usage by 85% faster. It turned out that the application copies lines a lot , many times.)


Not sure why your app crashed as you described. Since this is a warning about memory, you should see what most stands out.

Keep in mind that if you have zombie detection enabled, it takes up a lot of extra memory.

+9
source

There are various options for initializing Allocations. Verify the settings by clicking the "i" symbol in the Allocations tile.

Yes, I also find it annoying.

+2
source

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


All Articles