如何解决Instruments检测到的泄漏(其负责库是Apple的框架)?
我正在使用 Instruments Leaks 工具检查应用程序中的内存泄漏。
修复了所有泄漏后,其负责的库是我的应用程序。根据 Instruments 的说法,我发现仍然有很多泄漏,其负责的库是 iOS 的 framworks?
这是仪器的屏幕截图:
我认为这些泄漏可能是由于我滥用框架方法造成的。 遇到此类泄密事件时您的处理方法是什么?
谢谢!
I'm checking memory leaks in my apps using Instruments Leaks tool.
After fixing all leaks whose responsible library is my app. I figure out that there still have a lot of leaks whose responsible libraries are iOS's framworks, based on what Instruments said?
This is a screenshot of Intruments:
I think these leaks may be caused by some of my misuse of frameworks' methods.
What is your approach when getting leaks like these?
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
苹果开发者也是人,他们也会犯错误。另一种选择是创建与苹果的框架完全相同的框架,但这并不是一件好事,因为苹果将来肯定会提出升级和修复来解决这些问题。
唯一的解决方案是向 Apple 报告有关内存泄漏的错误,即使我已经看到该框架存在大量内存泄漏。
内存泄漏还有其他原因,仪器可能会在苹果的框架中显示内存泄漏,但这不一定是由框架的错误代码引起的,实际上它可能是我们代码中的错误,我们没有遵循正确的步骤,例如,我们添加观察者但不删除它们,我们绑定事件但不删除它们,所以如果我们没有正确完成清理操作,仪器可能会在其他地方显示泄漏。
Well Apple Developers are also human, and they also can make mistakes. Alternative would be to create your own framework exactly same to that of Apple's but that will not be nice thing to do as Apple will certainly come up with upgrades and fixes in future that will resolve the issues.
The only solution would be to report bugs to Apple about memory leaks, even I have seen that framework has lots of memory leaks.
There are also other reasons for memory leaks, instruments may show memory leaks in apple's framework, but it is not necessary that it is caused by the framework's bad code, indeed it could be the bug in our code where we did not follow correct steps, for example we add observers but we do not remove them, we bind for events but we do not remove them, so if we have not done cleaning operations correctly, instruments may show leak but somewhere else.
我在我的一个应用程序中也注意到了同样的情况,最后,在试图弄清楚我做错了什么之后,我得出的结论是我没有做错什么,苹果的框架也存在内存泄漏。
所以我认为你无能为力。
I've been noticing the same with one of my apps and in the end, after trying to figure out what I am doing wrong, I came to the conclusion I'm doing nothing wrong and that Apple's frameworks have memory leaks as well.
So I don't think there's anything you can do.