2

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:)

Community
  • 1
  • 1
Bastaix
  • 835
  • 3
  • 12
  • 23
  • 1
    No way to tell without seeing some source code. – Robby Pond Mar 17 '11 at 13:47
  • What do you want to know, what uses lots of ram in android applications or in java code? – gatnowurry Mar 17 '11 at 13:49
  • @Robby: I know. I wasn't thinking on this specific app. It is more in the line as if one should use arrays rather than ArrayLists, private classes when possible and so on. – Bastaix Mar 17 '11 at 13:50
  • Edit you question accordingly. It will be clearer to people looking at it before they get to read these comments. – Phonon Mar 17 '11 at 14:08

2 Answers2

5

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.

CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491
  • The Images was the problem. So my question has changed to [this](http://stackoverflow.com/questions/5340791/imageview-android-ram) – Bastaix Mar 17 '11 at 15:00
1

I would review your application against the guidelines listed in the Android Developers Dev Guide.

Not being aware of certain recommended practices could result in heavy memory usage by your app.

madman1969
  • 166
  • 2
  • Yes I have read this, and the RAM usage is declining. But I still wonder if there are some "simple" things to do to make the app use less RAM. Using something instead of others. – Bastaix Mar 17 '11 at 14:22