简体   繁体   English

如何解决Xcode中的iPhone应用程序内存泄漏(仪器)

[英]how to solve iPhone app memory leak in xcode(instruments)

Now i'm developing iPhone app but it seems happen memory leak. 现在我正在开发iPhone应用程序,但似乎发生了内存泄漏。 I found by Instruments: 我通过仪器发现:

在此处输入图片说明

I have question: 我有问题:

-- how to find where is code that happen memory leak about "Malloc xx bytes"? -如何找到发生有关“ Malloc xx字节”的内存泄漏的代码?

-- I think I can't improve memory leak in Library. -我想我无法改善Library中的内存泄漏。 Example for "Foundation", "StoreKit" and so on, right? “ Foundation”,“ StoreKit”等示例,对吗?

Switch to the call tree view to find the areas of your code allocating the leaked memory. 切换到调用树视图以查找代码中分配泄漏内存的区域。 For more detailed information, see my answer to the following question: 有关更多详细信息,请参阅我对以下问题的回答:

Unable to track memory issue 无法跟踪内存问题

Also for clearer representation of memory leaks select Allocation tool, go to File>Recording Options and tick "Discard events for freed memory". 同样,为了更清楚地表示内存泄漏,请选择分配工具,转到文件>记录选项,然后选中“丢弃事件以释放内存”。

In this way all the spikes that you will see in the chart will be actual unfreed memory 这样,您将在图表中看到的所有峰值都是实际的未释放内存

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM