为菜鸟提供使用仪器泄漏的建议
你好,我对 iPhone 开发还很陌生。我第一次使用“Instruments”中的“Leaks”运行我的应用程序。它向我展示了大约 20 个泄漏,最小的是 32 字节,还有一个 1KB。我遵循了内存管理指南,(我(认为我)了解如何以及何时使用释放,而不是在添加到自动释放池时使用它,对于每个副本,保留,初始化都应该有一个释放,...等等) 。我不认为我理解仪器泄漏的输出。 “负责任的图书馆”和“负责任的框架”是什么意思?因为有一些类和方法我从未直接使用过。它还显示了我在 connectionDidFinishLoading 方法和错误处理程序方法中释放的 NSURLConnection 对象。所以从技术上讲,它们是不可能泄漏的。是否有任何好的教程可以调试仪器中的内存泄漏,或者您可以给我有关泄漏的其他建议。提前致谢。
这是最大的 2 个泄漏。
Leaked Object # Address Size Responsible Library Responsible Frame Malloc 1.00 KB 0x4827400 1024 CFNetwork std::vector >*, std::allocator >*> >::reserve(unsigned long) // i have no idea what this is. Leaked Object # Address Size Responsible Library Responsible Frame Malloc 128 Bytes 5 640 UIKit UIImagePickerLoadPhotoLibraryIfNecessary // so this means UIImagePicker is leaking memory?
我收到的第一次泄漏
Leaked Object # Address Size Responsible Library Responsible Frame Malloc 128 Bytes 0x442dfd0 128 UIKit UIKeyboardInputManagerClassForInputMode
我不明白其中任何一个。
我发现很奇怪的是,即使是一个几乎空的应用程序,没有添加任何代码,只有一个视图和一个文本字段也会泄漏内存。
Hello I am pretty new to iphone development. I have run my app for the first time using the "Leaks" from "Instruments". It shows me several leaks around 20 the smallest is 32 bytes and there is one with 1KB. I have followed the memory management guidelines, (i (think i) understand how and when to use release, not to use it when adding to autorelease pools, for every copy, retain, init there should be a release,... etc). I don't think I understand the output of the Leaks in instruments. What does "Responsible library" and "Responsible frame" mean. Because there are some classes and methods i never used directly. It also shows NSURLConnection objects which I have realeased in the connectionDidFinishLoading method and also in the error handler method. So tehnically there is no way for them to leak. Are there any good tutorials for debugging memory leaks in instruments or other advice you can give me regarding leaks. Thanks in advance.
Here are the largest 2 leaks.
Leaked Object # Address Size Responsible Library Responsible Frame Malloc 1.00 KB 0x4827400 1024 CFNetwork std::vector >*, std::allocator >*> >::reserve(unsigned long) // i have no idea what this is. Leaked Object # Address Size Responsible Library Responsible Frame Malloc 128 Bytes 5 640 UIKit UIImagePickerLoadPhotoLibraryIfNecessary // so this means UIImagePicker is leaking memory?
The first leak i get
Leaked Object # Address Size Responsible Library Responsible Frame Malloc 128 Bytes 0x442dfd0 128 UIKit UIKeyboardInputManagerClassForInputMode
I don't understand any of those.
And I find it very strange that even an almost empty app with no code added, just a view and a textfield also leaks memory.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这是我找到的一些。如果还有其他的请添加。
http://www.cimgf .com/2008/04/02/cocoa-tutorial-fixing-memory-leaks-with-instruments
http://www.mobileorchard.com/find -iphone-内存泄漏-a-泄漏工具-教程
Here are some i found. If there are others then please add them.
http://www.cimgf.com/2008/04/02/cocoa-tutorial-fixing-memory-leaks-with-instruments
http://www.mobileorchard.com/find-iphone-memory-leaks-a-leaks-tool-tutorial