Using heap shot analysis shows memory addresses, but not lines of code. How do I determine what is causing the heap to grow?

后端 未结 2 676
一整个雨季
一整个雨季 2021-01-07 01:49

I\'m nearly finished with my app and I\'m using Instruments to optimize performance before I submit to the app store. I noticed that whenever I execute a particular action (

2条回答
  •  一生所求
    2021-01-07 02:09

    Start with bbum's tutorial: When is a Leak not a Leak?

    The short answer is that there is no tool that is going to tell you the exact line of code that causes a leak. The system does not know where you made your mistake. It knows when you allocated memory, and it knows that memory hasn't been released, but it has no way to know whether you meant to release the memory or not. It especially does not know when you should have released the memory because it has no way to know why you allocated it in the first place.

    Using heap shots, you can discover what the extra objects are, and from there you can audit how you use those objects.

提交回复
热议问题