Hello,
I am developing an app that contains many images.  I have noticed that
the memory usage of my app is quite a bit higher in Android 2.3 than
in Android 2.2 - ultimately resulting in OutOfMemory errors while
loading bitmaps.  In researching this, I logged the result of
Debug.getNativeHeapAllocatedSize() in the onResume of the first
activity.  In Android 2.2, this outputs 5MB.  In Android 2.3, this
outputs 17MB.

I created a sample application to try to further narrow this down.
The sample app has 2 activities:  the first has a small image and a
button to launch the second activity;  the second activity has several
large images in a ScrollView.  You can download the sample here:
http://dl.dropbox.com/u/21709517/MemoryUsageExample.zip
When running this sample, Debug.getNativeHeapAllocatedSize() reports
3MB allocated after starting the first activity in both 2.2 and 2.3.
After launching the second activity, Android 2.2 still reports 3MB
allocated while Android 2.3 reports 17MB allocated.  Running "adb
shell dumpsys meminfo test.example" shows the same types of results.

Why is there such a dramatic difference between Android 2.2 and 2.3?
And more importantly, what should I be doing differently to prevent
using so much memory on Android 2.3?

Jeff

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to