Using heap frame analysis, memory addresses are displayed, but not lines of code. How to determine what causes heap growth?

I almost finished my application, and I use tools to optimize performance before sending them to the application store. I noticed that whenever I perform a certain action (updating the information in my application from an external server), my heap grows by about 350 KB. The research I found here in stackoverflow and the Apple documentation suggests executing Heap heaps to find the violation code. However, instead of leading me to a violation code, it shows me the memory addresses.

Is there any way to use this information? Or should I use another tool? I'm new to Tools, so I appreciate any help.

I would show a screenshot, but my reputation is still not high enough.

+2
source share
2 answers

A few thoughts:

  • In the heap heap, be sure to show the extended part ( + E or select “Extended Part” in the “View” menu) on the right-most toolbar.

    When viewing the extended part, it will show you the stack trace, and you can double-click on the name of your method there (which will be black, not light gray), and you will get to the line that generated (which, obviously, is not required for the root problems, but it will show you where the object was originally selected, which is the place to start).

    view extended detail in heapshot analysis

  • Having said that, I usually focus on the standard Selection tool. I have option -drag in the distribution toolbar at the top to highlight the selection during this run-time window, then I will select the Call Tree and focus only on my code, I will check the Invert Call Tree and Hide System Libraries:

    option drag in allocations tool

    For me, I believe that a more efficient way to determine my distributions that occurred during this time is without sifting through system distributions.

  • Remember to run your code through a static analyzer in Xcode ( shift + + B ) or select "Analyze" from the "Product" menu). Before you start the application with the tools, you should get a clean account.

+1
source

Start with the bbum tutorial: When is a leak not a leak?

The short answer is that there is no tool that will tell you the exact line of code that causes the leak. The system does not know where you made your mistake. He knows when you allocated the memory, and he knows that the memory was not released, but she has no way of knowing if you want to free the memory or not. This especially does not know when you were supposed to free memory, because it does not have the opportunity to find out why you allocated it in the first place.

Using heaps, you can find out what additional objects are, and from there you can check how you use these objects.

+1
source

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


All Articles