Android应用程序内存占用 [英] Android app RAM usage

查看:162
本文介绍了Android应用程序内存占用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚才做Android手机的应用程序。这是一个相当简单的应用程序,但它使用了高达25 MB RAM。

没有得到什么是使用大量的RAM,Android的任何回答这个特定的应用程序,但有什么看法? (我知道这是一个相当宽泛的问题,但我只是想知道)

修改 我的意思是,如果一个人应该使用阵列,而不是的ArrayList ,使用私有类在可能的情况等。

更新 我现在已经做了内存占用小一些(半)。我做了字符串最后可能时,创造,而不是一个内部私有类公共课。 (不知道这一点,什么原因造成的)。

更新

我现在找到了大内存的食客。我有一些ImageViews,这是通过URI路径引用的图片库的图片。

所以我的问题有变化,新问题是这里 :)

解决方案
  

但一般是什么使用大量的RAM,Android的?

位图。这是困难的,除非你正在使用大量位图图像或做一些事情,应该是再明显作为一个潜在的内存问题(例如,装载10000条记录从数据库中)跑出来的RAM。

您可以使用DDMS转储堆和使用Eclipse MAT插件,如果您想了解更多关于什么是你的应用程序的内存内部发生的检验。

I have just made an app for Android phones. It is a rather simple app, yet it uses up to 25 MB RAM.

Not to get any answer to this specific app but in general what is using a lot of RAM in android? (I know this is a rather broad question, but I was just wondering)

EDIT What i mean is if one should use arrays rather than ArrayList, use private Class when possible and so on.

Update I have now made the RAM usage a little smaller (half). I have made String final when possible and created a public class instead of a inner private class. (don't know if this it what caused it).

Update

I now found the BIG RAM eater. I had some ImageViews, which were referenced a picture in the picture gallery via an URI path.

So my question have change: new Question is here:)

解决方案

but in general what is using a lot of RAM in android?

Bitmaps. It is difficult to run out of RAM unless you are using lots of bitmap images or doing something that should be blindingly obvious as a potential RAM issue (e.g., loading 10,000 records out of a database).

You can dump the heap using DDMS and inspect it using the Eclipse MAT plug-in, if you want to learn more about what is going on inside your app's RAM.

这篇关于Android应用程序内存占用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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