如何查找我们的应用程序中的内存泄漏
我正在开发一个相机应用程序,并且已成功集成它,但问题是,当我第一次捕获图像并进入 Safari 页面时,一切正常。但是,如果我再次回到相机模式并再次进入 Safari 页面,应用程序就会崩溃,并且这些行会打印在控制台上:
2011-08-12 04:27:34.679brandCapture[816:707] 收到内存警告。级别=1
以及 Level=2
。
I am working on a camera application and I have integrated it successfully but problem is that when I capture the image at first time and going to Safari page its fine. But if I again come back in camera mode and again go to Safari page the application is crashed and these line are printed on console:
2011-08-12 04:27:34.679 brandCapture[816:707] Received memory warning. Level=1
and also with Level=2
.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您还可以使用仪器(例如泄漏),这非常有帮助。您可以在这里找到教程: http ://www.cimgf.com/2008/04/02/cocoa-tutorial-fixing-memory-leaks-with-instruments/
You can also use Instruments (e.g. Leaks), which is very helpful. You can find a tutorial here: http://www.cimgf.com/2008/04/02/cocoa-tutorial-fixing-memory-leaks-with-instruments/
在 XCode 顶部的“运行”按钮中,单击箭头,将出现 4 个选项,选择“分析”。编译器将分析您的整个应用程序,并在错误列中通知您所有泄漏。单击每个泄漏以转到泄漏的代码,代码处会有一个蓝色箭头或线条,您会注意到一个蓝色按钮,单击它,它会告诉您为什么会出现内存泄漏。希望这有帮助
At the Run button on top of your XCode, click at the arrow, 4 options will appear, choose analyze. The compiler will analyze your whole application, and at the error column they will notify you with all the leaks. Click each leak to go to the code of the leak, there will be a blue arrow or line at the code, you will notice a blue button, click it and it will show you why is there a memory leak. Hope this helps