使用仪器工具定位泄漏点 [英] Using instruments tool to locate leaks

查看:73
本文介绍了使用仪器工具定位泄漏点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用泄漏仪器在我的应用程序中查找泄漏. 该应用启动时,我可以看到106个泄漏,但找不到它们.

I am trying to find leaks in my app using the leaks instrument. When the app launches I can see 106 leaks and I am having trouble in finding them.

在图像中您可以看到列表的一部分,但是我该如何深入到生成泄漏的类或代码行呢?

In the image you can see part of the list, but how can I drill down to the class or line of code that generates the leak?

推荐答案

查找泄漏并非如此简单.您需要戴上侦探帽,从外套中拿出放大镜,然后开始寻找踪迹.即

Finding a leak is not that simple. You need to wear the detective cap, take out your magnifying glass from your coat and start find the trail. i.e.

对于每个泄漏的对象,都有一个负责任的库.如果是UIKit,Foundation或任何低级的东西,您将无法查明导致泄漏的代码的位置,因为这些库采用二进制形式.

For every leaked object there is a responsible library. If it is a UIKit, Foundation or anything low-level, you won't be able to pin point the location of code that is causing the leak since these libraries are in the form of binaries.

如果负责编写的库是您正在编写的库,则可以通过在右侧的堆栈跟踪面板中单击正确的方法来转到代码.一个提示是,如果有相应的代码可用,则堆栈跟踪面板中列出的方法将突出显示.

If the responsible library is the one you are writing then you can go to the code by clicking the right method in the stack trace panel on the right. One hint is that the methods listed in the stack trace panel become highlighted if there is a corresponding code available.

但是,由于不是那么简单,通常您自己的代码会导致某些内部库泄漏,这很难调试.在开始之前,您需要阅读一些教程并练习材料.在stackoverflow上肯定无法解决某些问题.

But, since it is not that straight forward, often your own piece of code causes some internal library to leak which is hard to debug. You need to go through some tutorials and practice material before you start. Something certainly not answerable on stackoverflow.

这篇关于使用仪器工具定位泄漏点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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