Closed Bug 707675 Opened 8 years ago Closed 8 years ago

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

Categories

(Firefox for Android :: General, defect, critical)

ARM
Android
defect
Not set
critical

Tracking

()

VERIFIED FIXED

People

(Reporter: aaronmt, Assigned: blassey)

References

Details

(Keywords: crash, reproducible, Whiteboard: [native-crash][inbound])

Attachments

(2 files)

E/AndroidRuntime( 1173): FATAL EXCEPTION: Thread-13
E/AndroidRuntime( 1173): java.lang.OutOfMemoryError: bitmap size exceeds VM budget
E/AndroidRuntime( 1173): 	at android.graphics.Bitmap.nativeCreate(Native Method)
E/AndroidRuntime( 1173): 	at android.graphics.Bitmap.createBitmap(Bitmap.java:477)
E/AndroidRuntime( 1173): 	at org.mozilla.gecko.gfx.GeckoSoftwareLayerClient.getBitmap(GeckoSoftwareLayerClient.java:193)
E/AndroidRuntime( 1173): 	at org.mozilla.gecko.GeckoApp$3.run(GeckoApp.java:601)
E/AndroidRuntime( 1173): 	at android.os.Handler.handleCallback(Handler.java:587)
E/AndroidRuntime( 1173): 	at android.os.Handler.dispatchMessage(Handler.java:92)
E/AndroidRuntime( 1173): 	at android.os.Looper.loop(Looper.java:130)
E/AndroidRuntime( 1173): 	at org.mozilla.gecko.GeckoAppShell$LooperThread.run(GeckoAppShell.java:153)
W/ActivityManager(  110):   Force finishing activity org.mozilla.fennec/org.mozilla.gecko.TabsTray
W/ActivityManager(  110):   Force finishing activity org.mozilla.fennec/.App

STR:
1. http://espn.com, http://m.engadget.com
2. Switch between tabs

Surely my SII can be capable of opening two tabs without OOMing?

--
Samsung Galaxy SII (Android 2.3.4)
20111205040214
http://hg.mozilla.org/projects/birch/rev/85e665cc4a97
This is related to bug 706614 - there are multiple instances where the "thumbnail" is generated, and I only caught the OOM in one of them. We should definitely fix this properly and not be allocating ginormous bitmaps for thumbnail purposes.
Depends on: 706614
Summary: java.lang.OutOfMemoryError: bitmap size exceeds VM budget → Pre-scale thumbnail bitmap to avoid java.lang.OutOfMemoryError: bitmap size exceeds VM budget
I'm getting this in the emulator, but 5 secs after startup, on about:home (with no other tabs open). I'm presuming it's the same issue, but can file separately if you think it happening on about:home/the slightly different line numbers in the stacktrace mean it's not the same?

http://pastebin.mozilla.org/1394210

emulator settings:
vm.heapSize 24
hw.ramSize 768
Assignee: nobody → blassey.bugs
Just returning and handling null seemed cleaner than adding a new checked exception to wrap the OOM, so I went with that approach. This should be enough to unblock lucasr.
Attachment #579763 - Flags: review?(blassey.bugs)
Attachment #579763 - Flags: review?(blassey.bugs) → review+
Summary: Pre-scale thumbnail bitmap to avoid java.lang.OutOfMemoryError: bitmap size exceeds VM budget → avoid java.lang.OutOfMemoryError: bitmap size exceeds VM budget
pushed to inbound https://hg.mozilla.org/integration/mozilla-inbound/rev/25bbec664cb0
Whiteboard: [native-crash] → [native-crash][inbound]
https://hg.mozilla.org/mozilla-central/rev/25bbec664cb0
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Duplicate of this bug: 706878
To QA Testers : When running tests to verify this bug fix, please run steps in bug 706878 to verify it's a dup.
Duplicate of this bug: 710316
I can still reproduce this (icanhazcheeseburger.com):

D/dalvikvm( 3405): GC_EXTERNAL_ALLOC freed 838K, 67% free 3488K/10311K, external 20942K/22868K, paused 66ms
E/dalvikvm-heap( 3405): 4194304-byte external allocation too large for this process.
D/dalvikvm( 3405): GC_FOR_MALLOC freed 0K, 67% free 3488K/10311K, external 20942K/22868K, paused 27ms
E/GraphicsJNI( 3405): VM won't let us allocate 4194304 bytes
E/GeckoSoftwareLayerClient( 3405): Unable to create bitmap
E/GeckoSoftwareLayerClient( 3405): java.lang.OutOfMemoryError: bitmap size exceeds VM budget
E/GeckoSoftwareLayerClient( 3405): 	at android.graphics.Bitmap.nativeCreate(Native Method)
E/GeckoSoftwareLayerClient( 3405): 	at android.graphics.Bitmap.createBitmap(Bitmap.java:477)
E/GeckoSoftwareLayerClient( 3405): 	at org.mozilla.gecko.gfx.GeckoSoftwareLayerClient.getBitmap(GeckoSoftwareLayerClient.java:207)
E/GeckoSoftwareLayerClient( 3405): 	at org.mozilla.gecko.GeckoApp$SessionSnapshotRunnable.run(GeckoApp.java:607)
E/GeckoSoftwareLayerClient( 3405): 	at android.os.Handler.handleCallback(Handler.java:587)
E/GeckoSoftwareLayerClient( 3405): 	at android.os.Handler.dispatchMessage(Handler.java:92)
E/GeckoSoftwareLayerClient( 3405): 	at android.os.Looper.loop(Looper.java:130)
E/GeckoSoftwareLayerClient( 3405): 	at org.mozilla.gecko.GeckoAppShell$LooperThread.run(GeckoAppShell.java:153)


Running an hourly from today (12/13)

Samsung Nexus S (Android 2.3.6)
20111213113518
http://hg.mozilla.org/mozilla-central/rev/a111d03d465c
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Aaron - but it's no longer a fatal exception, right? Yes, we still log the exception, but we should no longer crash.
Status: REOPENED → RESOLVED
Closed: 8 years ago8 years ago
Resolution: --- → FIXED
Comment on attachment 579763 [details] [diff] [review]
Catch/handle OOMs

Review of attachment 579763 [details] [diff] [review]:
-----------------------------------------------------------------

::: mobile/android/base/gfx/GeckoSoftwareLayerClient.java
@@ +204,5 @@
> +                                           CairoUtils.cairoFormatTobitmapConfig(mFormat));
> +            b.copyPixelsFromBuffer(mBuffer.asIntBuffer());
> +            return b;
> +        } catch (OutOfMemoryError oom) {
> +            Log.e(LOGTAG, "Unable to create bitmap", oom);

Let's use the logging level correctly. This should be logged as a warning and not an error. Kat's can you push a follow up, preemptive r=blassey
Unable to reproduce this issue on:
Nightly 13.0a1(2012-03-04)
Device: Samsung Galaxy S2
OS: Android 2.3.4
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.