I'm having problems with ListViews in my application. I thought
everything was fine until I noticed that if I scrolled up and down
through the list quickly a number of times, sooner or later the app
would crash with an OutOfMemoryError.

When I searched for the error I noticed a number of posts related to
loading images. As my list items included a small arrow png, I assumed
the problem lay here. However even after removing this and all other
drawables I had (gradient background and list separator) the problem
still remains.

Here's the stack trace

ERROR/dalvikvm-heap(2362): 66560-byte external allocation too large
for this process.
ERROR/(2362): VM won't let us allocate 66560 bytes
DEBUG/AndroidRuntime(2362): Shutting down VM
WARN/dalvikvm(2362): threadid=3: thread exiting with uncaught
exception (group=0x40013e28)
ERROR/AndroidRuntime(2362): Uncaught handler: thread main exiting due
to uncaught exception
ERROR/AndroidRuntime(2362): java.lang.OutOfMemoryError: bitmap size
exceeds VM budget
ERROR/AndroidRuntime(2362):     at android.graphics.Bitmap.nativeCreate
(Native Method)
ERROR/AndroidRuntime(2362):     at android.graphics.Bitmap.createBitmap
(Bitmap.java:343)
ERROR/AndroidRuntime(2362):     at android.view.View.buildDrawingCache
(View.java:5219)
ERROR/AndroidRuntime(2362):     at android.view.View.getDrawingCache
(View.java:5112)
ERROR/AndroidRuntime(2362):     at android.view.ViewGroup.drawChild
(ViewGroup.java:1355)
ERROR/AndroidRuntime(2362):     at android.view.ViewGroup.dispatchDraw
(ViewGroup.java:1192)
ERROR/AndroidRuntime(2362):     at
android.widget.AbsListView.dispatchDraw(AbsListView.java:1125)
ERROR/AndroidRuntime(2362):     at android.widget.ListView.dispatchDraw
(ListView.java:2778)
ERROR/AndroidRuntime(2362):     at android.view.View.draw(View.java:
5422)
ERROR/AndroidRuntime(2362):     at android.view.ViewGroup.drawChild
(ViewGroup.java:1420)
ERROR/AndroidRuntime(2362):     at android.view.ViewGroup.dispatchDraw
(ViewGroup.java:1192)
ERROR/AndroidRuntime(2362):     at android.view.ViewGroup.drawChild
(ViewGroup.java:1418)
ERROR/AndroidRuntime(2362):     at android.view.ViewGroup.dispatchDraw
(ViewGroup.java:1192)
ERROR/AndroidRuntime(2362):     at android.view.View.draw(View.java:
5329)
ERROR/AndroidRuntime(2362):     at android.widget.FrameLayout.draw
(FrameLayout.java:324)
ERROR/AndroidRuntime(2362):     at android.view.ViewGroup.drawChild
(ViewGroup.java:1420)
ERROR/AndroidRuntime(2362):     at android.view.ViewGroup.dispatchDraw
(ViewGroup.java:1192)
ERROR/AndroidRuntime(2362):     at android.view.ViewGroup.drawChild
(ViewGroup.java:1418)
ERROR/AndroidRuntime(2362):     at android.view.ViewGroup.dispatchDraw
(ViewGroup.java:1192)
ERROR/AndroidRuntime(2362):     at android.view.View.draw(View.java:
5329)
ERROR/AndroidRuntime(2362):     at android.widget.FrameLayout.draw
(FrameLayout.java:324)
ERROR/AndroidRuntime(2362):     at
com.android.internal.policy.impl.PhoneWindow$DecorView.draw
(PhoneWindow.java:1701)
ERROR/AndroidRuntime(2362):     at android.view.ViewRoot.draw
(ViewRoot.java:980)
ERROR/AndroidRuntime(2362):     at
android.view.ViewRoot.performTraversals(ViewRoot.java:829)
ERROR/AndroidRuntime(2362):     at android.view.ViewRoot.handleMessage
(ViewRoot.java:1103)
ERROR/AndroidRuntime(2362):     at android.os.Handler.dispatchMessage
(Handler.java:88)
ERROR/AndroidRuntime(2362):     at android.os.Looper.loop(Looper.java:
123)
ERROR/AndroidRuntime(2362):     at android.app.ActivityThread.main
(ActivityThread.java:3742)
ERROR/AndroidRuntime(2362):     at
java.lang.reflect.Method.invokeNative(Native Method)
ERROR/AndroidRuntime(2362):     at java.lang.reflect.Method.invoke
(Method.java:515)
ERROR/AndroidRuntime(2362):     at com.android.internal.os.ZygoteInit
$MethodAndArgsCaller.run(ZygoteInit.java:739)
ERROR/AndroidRuntime(2362):     at
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:497)
ERROR/AndroidRuntime(2362):     at dalvik.system.NativeStart.main
(Native Method)

I've had a look in DDMS and noticed that the percentage memory used in
the heap doesn't go above 70%. Also, doesn't the reported 66K seem
like a very small amount to be causing a crash?

Any help appreciated!

--~--~---------~--~----~------------~-------~--~----~
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