Hello World on Android consuming a lot of RAM

Asked

Viewed 894 times

2

I’m doing an application and I noticed that it is consuming a lot of RAM, approximately 70MB. I have a button that inflates an extra layout with random data and that keep changing dynamically that because of this increases the memory used in Android.

Researching deeply I realized that the Hello World Andorid already consumes 13MB and he only has one activity and a text.

My question is how to improve memory usage in application code? How do I clear cache memory or kill an Activity? (In my app killing an Activity doesn’t solve much)

1 answer

3


There is a Thread in the Android group Brazil Dev (Google Groups) that talks about memory management and memory reserve, worth a read.

https://groups.google.com/forum/#! topic/androidbrasil-dev/cFcEAI5LPIc

Edit:

This thread of discussion in Google Group brings a very important information where there is a minimum memory allocation for each type of device see.

Fonte: (http://source.android.com/compatibility/downloads.html Note: I find it kind of strange applications that use xLarge with xxHdpi Screem Density to use 256MB, for me is a lot of memory.

source: http://source.android.com/compatibility/downloads.html

Another very important information with the control of images where it is guiding to decrease the images using the thumbnail process.

Follow the very interesting links about memory management on Android.

Video Google IO 2011

Weak References

Material how Garbage Collector works

  • it says that image processing enhances the memory reserved for app, this can occur with png too?

  • Any type of image, so it is highly recommended that you decrease the size of the image before loading, like creating a thumbnail. For this look for Bitmap.createScaledBitmap the process is basically to create a reduced file based on the original file. Edit: Logic that create the thumbnail only to demonstrate in the gallery, but have the option of the user to view the image in the original size.

  • 1

    Even if this link is a good suggestion, this reply will not be valid if one day the link ceases to work. So, and also because it’s important for the community to have content right here, you’d better respond with more complete answers. Can you elaborate more your answer? A summary of the content of the link would help a lot! Learn more on this item in our Community FAQ: Answers that only contain links are good?

Browser other questions tagged

You are not signed in. Login or sign up in order to post.