Android 小部件中的内存分配
我在 Android 中开发了一个小部件,它使用了太多 RAM(超过 30 MB)。到底是什么东西占用了这么多内存呢?该小部件是一个时钟和天气小部件,使用不同的皮肤(另存为可绘制对象)。
谢谢
I have developed a widget in Android and it uses too much RAM (over 30 MB). What can it be that takes up so much memory? The widget is a clock and weather widget that uses different skins (saved as drawables).
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
很难说可能有很多事情。但幸运的是,Android DDMS 有一个分配跟踪器,它可能会帮助您解决问题。
http://developer.android.com/guide/developing/debugging/ddms.html
It's hard to say could be a lot of thing. But lucky for you Android DDMS has a Allocation Tracker, that might help you solve your problem.
http://developer.android.com/guide/developing/debugging/ddms.html
您还可以使用插件 内存分析器工具
详细信息您可以参考:
https://stackoverflow.com/questions/1147172/what-android-tools-and-methods-work-best-to-find-memory-resource-leaks
https://stackoverflow.com/questions/2298208/如何发现 Android 中我的应用程序的内存使用情况
另一个很好的文档指南如何很好地设计小部件的布局:
http://developer.android.com/training/improving-layouts/optimizing-布局.html
You can also using plugin Memory Analyzer tool
Detail you can refer:
https://stackoverflow.com/questions/1147172/what-android-tools-and-methods-work-best-to-find-memory-resource-leaks
https://stackoverflow.com/questions/2298208/how-to-discover-memory-usage-of-my-application-in-android
Another good document guide how to well design layout for widget:
http://developer.android.com/training/improving-layouts/optimizing-layout.html