OOM in BitmapFactory.decodeResource() in ImageUtilities.loadImageResource()

Bug #796730 reported by pjv
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Collectionista
New
Low
Unassigned

Bug Description

Monkey caught this on emulator-2.1 (seen twice, 0.3.4). The 2.1 emulator is old and very slow. So this even recreated the problem from bug #767567, but then on opening a resId drawable, instead of an unknown drawable. Maybe I should make the CD default covers smaller. Or I should fix it in the same way. But I don't think this is a big issue in real life, when you run OOM, you run OOM.

// CRASH: net.lp.collectionista (pid 357)

// Short Msg: bitmap size exceeds VM budget

// Long Msg: java.lang.OutOfMemoryError: bitmap size exceeds VM budget

// Build Label: android:generic/sdk/generic/:2.1-update1/ECLAIR/35983:eng/test-keys

// Build Changelist: 35983

// Build Time: 1273161972

// ID:

// Tag: AndroidRuntime

// java.lang.OutOfMemoryError: bitmap size exceeds VM budget

// at android.graphics.BitmapFactory.nativeDecodeAsset(BitmapFactory.java:-2)

// at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:447)

// at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:323)

// at android.graphics.BitmapFactory.decodeResource(BitmapFactory.java:346)

// at net.lp.collectionista.util.ImageUtilities.loadImageResource(ImageUtilities.java:408)

// at net.lp.collectionista.util.ImageUtilities.getImage(ImageUtilities.java:496)

// at net.lp.collectionista.domain.items.cd.CDItem.getBackCoverImageForFormField(CDItem.java:482)

// at net.lp.collectionista.ui.activities.items.cd.music.MusicCDItemEditWindow$7.perform(MusicCDItemEditWindow.java:685)

// at net.lp.collectionista.ui.activities.collections.ImageRepresentationLoader$1.run(ImageRepresentationLoader.java:47)

// at java.lang.Thread.run(Thread.java:1096)

** Monkey aborted due to error.

Events injected: 3582

:Dropped: keys=0 pointers=4 trackballs=0 flips=0

## Network stats: elapsed time=380857ms (380857ms mobile, 0ms wifi, 0ms not connected)

** System appears to have crashed at event 3582 of 10000 using seed 1

Revision history for this message
pjv (pjv) wrote :

Idem with this one, same monkey. Also a built-in drawable: mOverlayImage = resources.getDrawable(R.drawable.cd);

// CRASH: net.lp.collectionista (pid 647)

// Short Msg: bitmap size exceeds VM budget

// Long Msg: java.lang.OutOfMemoryError: bitmap size exceeds VM budget

// Build Label: android:generic/sdk/generic/:2.1-update1/ECLAIR/35983:eng/test-keys

// Build Changelist: 35983

// Build Time: 1273161972

// ID:

// Tag: AndroidRuntime

// java.lang.OutOfMemoryError: bitmap size exceeds VM budget

// at android.graphics.BitmapFactory.nativeDecodeAsset(BitmapFactory.java:-2)

// at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:447)

// at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:323)

// at android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:697)

// at android.content.res.Resources.loadDrawable(Resources.java:1705)

// at android.content.res.Resources.getDrawable(Resources.java:580)

// at net.lp.collectionista.domain.items.cd.CDItem$CDArtworkCreator.<init>(CDItem.java:124)

// at net.lp.collectionista.ui.activities.collections.cd.CDCollectionViewWindow.setupViews(CDCollectionViewWindow.java:1176)

// at net.lp.collectionista.ui.activities.collections.cd.CDCollectionViewWindow.onCreate(CDCollectionViewWindow.java:720)

// at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)

// at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2459)

// at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2512)

// at android.app.ActivityThread.access$2200(ActivityThread.java:119)

// at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1863)

// at android.os.Handler.dispatchMessage(Handler.java:99)

// at android.os.Looper.loop(Looper.java:123)

// at android.app.ActivityThread.main(ActivityThread.java:4363)

// at java.lang.reflect.Method.invokeNative(Method.java:-2)

// at java.lang.reflect.Method.invoke(Method.java:521)

// at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)

// at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)

// at dalvik.system.NativeStart.main(NativeStart.java:-2)

** Monkey aborted due to error.

Events injected: 2947

:Dropped: keys=0 pointers=87 trackballs=0 flips=0

## Network stats: elapsed time=359613ms (359613ms mobile, 0ms wifi, 0ms not connected)

** System appears to have crashed at event 2947 of 10000 using seed 3

Changed in collectionista:
importance: Undecided → Low
description: updated
Revision history for this message
pjv (pjv) wrote :

Monkey picked this up on N1 (v0.3.8 debug):

// CRASH: net.lp.collectionista (pid 19731)

// Short Msg: java.lang.OutOfMemoryError

// Long Msg: java.lang.OutOfMemoryError: bitmap size exceeds VM budget

// Build Label: unknown

// Build Changelist: eng.pjv.20100711.192135

// Build Time: 1278868973000

// java.lang.OutOfMemoryError: bitmap size exceeds VM budget

// at android.graphics.Bitmap.nativeCreate(Native Method)

// at android.graphics.Bitmap.createBitmap(Bitmap.java:468)

// at android.graphics.Bitmap.createBitmap(Bitmap.java:435)

// at android.graphics.Bitmap.createScaledBitmap(Bitmap.java:340)

// at android.graphics.BitmapFactory.finishDecode(BitmapFactory.java:488)

// at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:462)

// at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:323)

// at android.graphics.BitmapFactory.decodeResource(BitmapFactory.java:346)

// at net.lp.collectionista.util.ImageUtilities.loadImageResource(ImageUtilities.java:408)

// at net.lp.collectionista.util.ImageUtilities.getImage(ImageUtilities.java:496)

// at net.lp.collectionista.domain.items.cd.CDItem.getCoverImageForFormField(CDItem.java:515)

// at net.lp.collectionista.ui.activities.items.cd.music.MusicCDItemEditWindow$6.perform(MusicCDItemEditWindow.java:664)

// at net.lp.collectionista.ui.activities.collections.ImageRepresentationLoader$1.run(ImageRepresentationLoader.java:47)

// at java.lang.Thread.run(Thread.java:1096)

//

** Monkey aborted due to error.

Events injected: 5414

:Dropped: keys=2 pointers=0 trackballs=0 flips=0

## Network stats: elapsed time=205448ms (0ms mobile, 205448ms wifi, 0ms not connected)

** System appears to have crashed at event 5414 of 10000 using seed 7

Revision history for this message
pjv (pjv) wrote :
Download full text (4.0 KiB)

Slightly more different. Seen on monkey once on N1 (2.2). Can't load the layout because memory is already full because of bitmaps from decodeResource:

    // Allowing start of Intent { act=android.intent.action.VIEW dat=content://net.lp.collectionista.products/collections/2 cmp=net.lp.collectionista/.ui.activities.collections.cd.CDCollectionViewWindow } in package net.lp.collectionista
// CRASH: net.lp.collectionista (pid 7722)
// Short Msg: java.lang.OutOfMemoryError
// Long Msg: java.lang.OutOfMemoryError: bitmap size exceeds VM budget
// Build Label: unknown
// Build Changelist: eng.pjv.20100711.192135
// Build Time: 1278868973000
// java.lang.RuntimeException: Unable to start activity ComponentInfo{net.lp.collectionista/net.lp.collectionista.ui.activities.collections.cd.CDCollectionViewWindow}: android.view.InflateException: Binary XML file line #43: Error inflating class <unknown>
// at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663)
// at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
// at android.app.ActivityThread.access$2300(ActivityThread.java:125)
// at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
// at android.os.Handler.dispatchMessage(Handler.java:99)
// at android.os.Looper.loop(Looper.java:123)
// at android.app.ActivityThread.main(ActivityThread.java:4627)
// at java.lang.reflect.Method.invokeNative(Native Method)
// at java.lang.reflect.Method.invoke(Method.java:521)
// at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
// at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
// at dalvik.system.NativeStart.main(Native Method)
// Caused by: android.view.InflateException: Binary XML file line #43: Error inflating class <unknown>
// at android.view.LayoutInflater.createView(LayoutInflater.java:513)
// at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:565)
// at android.view.LayoutInflater.rInflate(LayoutInflater.java:618)
// at android.view.LayoutInflater.inflate(LayoutInflater.java:407)
// at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
// at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
// at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:198)
// at android.app.Activity.setContentView(Activity.java:1647)
// at net.lp.collectionista.ui.activities.collections.cd.CDCollectionViewWindow.onCreate(Collectionista:389)
// at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
// at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
// ... 11 more
// Caused by: java.lang.reflect.InvocationTargetException
// at net.lp.collectionista.ui.views.ContinuousShelvesView.<init>(Collectionista:41)
// at java.lang.reflect.Constructor.constructNative(Native Method)
// at java.lang.reflect.Constructor.newInstance(Constructor.java:446)
// at android.view.LayoutInflater.createView(LayoutInflater.java:500)
// ... 21 more
// Caused by: java.lang.OutOfMemoryError: bitmap size exceeds VM budget
// at android.graphics.Bitmap.nativeCreate(Native Method)
// at android.graphics.Bi...

Read more...

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.