本文介绍了如何准确找到iPhone项目中内存泄漏的位置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Xcode内存中开发应用程序时正在发生泄漏。当我在扩展详细信息视图中检查它们时,它们显示的是与实现无关的不同方法。如何准确找出泄漏的对象以及泄漏内存的位置。

While developing apps in Xcode memory leaks are occurring. When I checked them in extended detail view they are showing different methods that are not related to implemented. How to exactly find out which object is leaking and where it is leaking memory.

当ARC启用时,我们是否需要处理内存泄漏?

When ARC is enabled we have to take care of memory leaks or not?

推荐答案

即使使用 ARC 也可能发生内存泄漏,它只是在编译期间插入release和autorelease时间。

Even with ARC memory leaks can occur, it just inserts release and autorelease during compile time.

1。您必须使用在XCode中构建和分析来检查泄漏, shift + command + b 你应该清除那些问题。

1. You must check for leaks using Build and analyze in XCode, shift+command+b you should be clearing those issues.

2. 之后,您可以使用配置文件选项命令+ i 。这将指出泄漏的位置。

2. After that you can start using the instruments by using profile option command+i . This will point you to where the leak might be.

此链接也可以帮助你

编辑:添加了一些屏幕截图,希望能说清楚。

Added some screenshots to hopefully make it clear.

在分析之后选择泄漏选择调用树选项并选中隐藏系统库反转调用树仅显示obj-c ,如下图所示。

During profiling after selecting leaks choose the call tree option and check the boxes hide system libraries , invert call tree and show obj-c only as shown in image below.

双击下面的符号名称后,您将获得泄漏的行。

After double clicking the symbol name below you'll get the line where it is leaking.

你我会得到这样的东西。

You'll get something like this.

这篇关于如何准确找到iPhone项目中内存泄漏的位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-27 06:13