在Instruments的“泄漏块"中进行输入在应用程序运行期间暗示内存泄漏? [英] does an entry in Instruments "leaked block" during application running imply memory leak?

查看:90
本文介绍了在Instruments的“泄漏块"中进行输入在应用程序运行期间暗示内存泄漏?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在应用程序运行期间,Instruments的泄漏块"中的条目是否暗示内存泄漏?

does an entry in Instruments "leaked block" during application running imply memory leak?

也就是说,如果在使用iPhone应用程序的途中途中途,您可能保留了一些变量,但尚未到达发布该应用程序的那一部分,那么请按照以下步骤进行显示:泄漏的块与否?

That is, if one is half way through using the iPhone application, where you might have some variables that have been retained but it hasn't got to the part of the application where it gets released, then do these show up as leaked blocks or not?

如果答案是尚未完成的变量确实在此处显示为泄漏的块,那么这将非常令人困惑,那么如果您要停止/暂停工具,在这种情况下,如何以一种方式运行工具您看到的任何泄漏块都是有效的内存泄漏吗? (例如,需要先终止应用程序才能结束所有操作,然后再查看工具吗?)

If the answer is that variables which have not been finished with do show up here as leaked blocks, then this would be quite confusing then if you are stopping/pausing instruments, in which case how would one run instruments in a manner whereby any leaked blocks you see are valid memory leaks? (e.g. need to kill application to end everything first and then look at instruments?)

推荐答案

Instruments中的泄漏表明Instruments无法从一组根"指针中的任何一个开始找到指向已分配内存的指针.具体来说,根据内存使用性能指南:

A leak in Instruments indicates that Instruments cannot find a pointer to the allocated memory starting at any of a group of "root" pointers. Specifically, from the Memory Usage Performance Guidelines:

泄漏"工具记录了应用程序中发生的所有分配事件,然后定期搜索应用程序的可写内存,寄存器和堆栈,以查找对任何活动内存块的引用.如果在这些位置之一中未找到对块的引用,则将其视为泄漏",并在详细信息"窗格中显示相关信息.

The Leaks instrument records all allocation events that occur in your application and then periodically searches the application’s writable memory, registers, and stack for references to any active memory blocks. If it does not find a reference to a block in one of these places, it deems the block a "leak" and displays the relevant information in the Detail pane.

因此,只要您在ivars,局部变量或静态变量之一中有指向某事物的指针,保留某事物就不会泄漏.但是泄漏泄漏工具在某些方面可能会引起混淆,有时苹果的框架会出现漏洞,有时会出现错误.

So retaining something is not a leak as long as you have a pointer to it in one of your ivars, local variables or static variables. But there are ways that the Leaks instrument can get confused, and sometimes Apple has a leak in their frameworks, and sometimes Instruments has a bug.

随着时间的推移或执行特定操作时,您正在寻找的泄漏稳定且泄漏的内存量显着增加.微小的一次性泄漏通常不值得追究.

The thing you're looking for with Leaks are steady and significant increases in the amount of leaked memory either over time or when doing specific actions. Tiny, one-time leaks are generally not worth chasing.

这篇关于在Instruments的“泄漏块"中进行输入在应用程序运行期间暗示内存泄漏?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆