question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

OutOfMemoryError crash when receiving picture

See original GitHub issue

Steps to reproduce:

  1. Try to upload a rather big picture (7MB 6000x4000 pixels). It is a normal DLSR size these days. Either via gallery or via “share to”, and either from home activity or from nearby.
  2. Crash

I can send you such pictures via email if you want.

System logs:

12-07 20:04:58.162 18524 28962 D CustomApiResult:  <?xml version="1.0" encoding="UTF-8"?><api batchcomplete=""><query><allimages/></query></api>
12-07 20:04:58.259 18524 28962 V ImageUtils: left: 0 right: 6000 top: 0 bottom: 4000
12-07 20:04:58.911   786 17525 I ActivityManager: Process org.telegram.messenger (pid 18450) has died
12-07 20:04:58.911   786 17525 D ActivityManager: cleanUpApplicationRecord -- 18450
12-07 20:04:58.921   786 17525 W ActivityManager: Scheduling restart of crashed service org.telegram.messenger/.NotificationsService in 1000ms
12-07 20:04:58.955 18524 28962 I art     : Starting a blocking GC Alloc
12-07 20:04:58.956 18524 28962 I art     : Starting a blocking GC Alloc
12-07 20:04:58.961 18524 28962 I art     : Alloc sticky concurrent mark sweep GC freed 4(88B) AllocSpace objects, 0(0B) LOS objects, 12% free, 108MB/124MB, paused 508us total 5.419ms
12-07 20:04:58.961 18524 28962 I art     : Starting a blocking GC Alloc
12-07 20:04:59.001 18524 28962 I art     : Alloc partial concurrent mark sweep GC freed 50(1528B) AllocSpace objects, 0(0B) LOS objects, 12% free, 108MB/124MB, paused 506us total 39.506ms
12-07 20:04:59.001 18524 28962 I art     : Starting a blocking GC Alloc
12-07 20:04:59.045 18524 28962 I art     : Alloc concurrent mark sweep GC freed 46(1568B) AllocSpace objects, 0(0B) LOS objects, 12% free, 108MB/124MB, paused 524us total 43.441ms
12-07 20:04:59.045 18524 28962 I art     : Forcing collection of SoftReferences for 91MB allocation
12-07 20:04:59.045 18524 28962 I art     : Starting a blocking GC Alloc
12-07 20:04:59.092 18524 28962 I art     : Alloc concurrent mark sweep GC freed 3(72B) AllocSpace objects, 0(0B) LOS objects, 12% free, 108MB/124MB, paused 746us total 46.376ms
12-07 20:04:59.092 18524 28962 W art     : Throwing OutOfMemoryError "Failed to allocate a 96000012 byte allocation with 16776880 free bytes and 83MB until OOM"
12-07 20:04:59.092 18524 28962 I art     : Starting a blocking GC Alloc
12-07 20:04:59.092 18524 28962 I art     : Starting a blocking GC Alloc
12-07 20:04:59.099 18524 28962 I art     : Alloc sticky concurrent mark sweep GC freed 4(640B) AllocSpace objects, 0(0B) LOS objects, 12% free, 108MB/124MB, paused 716us total 6.659ms
12-07 20:04:59.099 18524 28962 I art     : Starting a blocking GC Alloc
12-07 20:04:59.139 18524 28962 I art     : Alloc partial concurrent mark sweep GC freed 6(144B) AllocSpace objects, 0(0B) LOS objects, 12% free, 108MB/124MB, paused 575us total 38.958ms
12-07 20:04:59.139 18524 28962 I art     : Starting a blocking GC Alloc
12-07 20:04:59.178 18524 28962 I art     : Alloc concurrent mark sweep GC freed 3(72B) AllocSpace objects, 0(0B) LOS objects, 12% free, 108MB/124MB, paused 755us total 38.742ms
12-07 20:04:59.178 18524 28962 I art     : Forcing collection of SoftReferences for 91MB allocation
12-07 20:04:59.178 18524 28962 I art     : Starting a blocking GC Alloc
12-07 20:04:59.216 18524 28962 I art     : Alloc concurrent mark sweep GC freed 3(72B) AllocSpace objects, 0(0B) LOS objects, 12% free, 108MB/124MB, paused 509us total 37.197ms
12-07 20:04:59.216 18524 28962 I art     : Starting a blocking GC HomogeneousSpaceCompact
12-07 20:04:59.294 18524 28962 I art     : HomogeneousSpaceCompact marksweep + semispace GC freed 3(72B) AllocSpace objects, 0(0B) LOS objects, 12% free, 108MB/124MB, paused 77.453ms total 77.453ms
12-07 20:04:59.294 18524 28962 W art     : Throwing OutOfMemoryError "Failed to allocate a 96000012 byte allocation with 16777216 free bytes and 83MB until OOM"
12-07 20:04:59.324 18524 28962 W System.err: io.reactivex.exceptions.UndeliverableException: java.lang.OutOfMemoryError: Failed to allocate a 96000012 byte allocation with 16777216 free bytes and 83MB until OOM
12-07 20:04:59.329 18524 28962 W System.err: 	at io.reactivex.plugins.RxJavaPlugins.onError(RxJavaPlugins.java:367)
12-07 20:04:59.330 18524 28962 W System.err: 	at io.reactivex.internal.schedulers.ScheduledRunnable.run(ScheduledRunnable.java:69)
12-07 20:04:59.330 18524 28962 W System.err: 	at io.reactivex.internal.schedulers.ScheduledRunnable.call(ScheduledRunnable.java:57)
12-07 20:04:59.330 18524 28962 W System.err: 	at java.util.concurrent.FutureTask.run(FutureTask.java:237)
12-07 20:04:59.330 18524 28962 W System.err: 	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:272)
12-07 20:04:59.330 18524 28962 W System.err: 	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
12-07 20:04:59.330 18524 28962 W System.err: 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
12-07 20:04:59.330 18524 28962 W System.err: 	at java.lang.Thread.run(Thread.java:761)
12-07 20:04:59.330 18524 28962 W System.err: Caused by: java.lang.OutOfMemoryError: Failed to allocate a 96000012 byte allocation with 16777216 free bytes and 83MB until OOM
12-07 20:04:59.331 18524 28962 W System.err: 	at fr.free.nrw.commons.utils.ImageUtils.checkIfImageIsDark(ImageUtils.java:117)
12-07 20:04:59.331 18524 28962 W System.err: 	at fr.free.nrw.commons.utils.ImageUtils.checkIfImageIsTooDark(ImageUtils.java:88)
12-07 20:04:59.331 18524 28962 W System.err: 	at fr.free.nrw.commons.upload.UploadModel$$Lambda$8.apply(Unknown Source)
12-07 20:04:59.332 18524 28962 W System.err: 	at io.reactivex.internal.operators.single.SingleMap$MapSingleObserver.onSuccess(SingleMap.java:57)
12-07 20:04:59.332 18524 28962 W System.err: 	at io.reactivex.internal.operators.single.SingleMap$MapSingleObserver.onSuccess(SingleMap.java:64)
12-07 20:04:59.332 18524 28962 W System.err: 	at io.reactivex.internal.operators.single.SingleFromCallable.subscribeActual(SingleFromCallable.java:56)
12-07 20:04:59.332 18524 28962 W System.err: 	at io.reactivex.Single.subscribe(Single.java:3394)
12-07 20:04:59.332 18524 28962 W System.err: 	at io.reactivex.internal.operators.single.SingleMap.subscribeActual(SingleMap.java:34)
12-07 20:04:59.333 18524 28962 W System.err: 	at io.reactivex.Single.subscribe(Single.java:3394)
12-07 20:04:59.333 18524 28962 W System.err: 	at io.reactivex.internal.operators.single.SingleMap.subscribeActual(SingleMap.java:34)
12-07 20:04:59.333 18524 28962 W System.err: 	at io.reactivex.Single.subscribe(Single.java:3394)
12-07 20:04:59.333 18524 28962 W System.err: 	at io.reactivex.internal.operators.single.SingleZipArray.subscribeActual(SingleZipArray.java:64)
12-07 20:04:59.333 18524 28962 W System.err: 	at io.reactivex.Single.subscribe(Single.java:3394)
12-07 20:04:59.333 18524 28962 W System.err: 	at io.reactivex.Single.subscribe(Single.java:3380)
12-07 20:04:59.333 18524 28962 W System.err: 	at io.reactivex.Single.subscribe(Single.java:3351)
12-07 20:04:59.333 18524 28962 W System.err: 	at fr.free.nrw.commons.upload.UploadModel.receiveDirect(UploadModel.java:133)
12-07 20:04:59.333 18524 28962 W System.err: 	at fr.free.nrw.commons.upload.UploadPresenter.lambda$receiveDirect$4$UploadPresenter(UploadPresenter.java:96)
12-07 20:04:59.333 18524 28962 W System.err: 	at fr.free.nrw.commons.upload.UploadPresenter$$Lambda$3.run(Unknown Source)
12-07 20:04:59.333 18524 28962 W System.err: 	at io.reactivex.internal.operators.completable.CompletableFromRunnable.subscribeActual(CompletableFromRunnable.java:35)
12-07 20:04:59.333 18524 28962 W System.err: 	at io.reactivex.Completable.subscribe(Completable.java:2171)
12-07 20:04:59.333 18524 28962 W System.err: 	at io.reactivex.internal.operators.completable.CompletableSubscribeOn$SubscribeOnObserver.run(CompletableSubscribeOn.java:64)
12-07 20:04:59.333 18524 28962 W System.err: 	at io.reactivex.Scheduler$DisposeTask.run(Scheduler.java:579)
12-07 20:04:59.333 18524 28962 W System.err: 	at io.reactivex.internal.schedulers.ScheduledRunnable.run(ScheduledRunnable.java:66)
12-07 20:04:59.333 18524 28962 W System.err: 	... 6 more
12-07 20:04:59.337 18524 28962 E AndroidRuntime: FATAL EXCEPTION: RxCachedThreadScheduler-11
12-07 20:04:59.337 18524 28962 E AndroidRuntime: Process: fr.free.nrw.commons, PID: 18524
12-07 20:04:59.337 18524 28962 E AndroidRuntime: io.reactivex.exceptions.UndeliverableException: java.lang.OutOfMemoryError: Failed to allocate a 96000012 byte allocation with 16777216 free bytes and 83MB until OOM
12-07 20:04:59.337 18524 28962 E AndroidRuntime: 	at io.reactivex.plugins.RxJavaPlugins.onError(RxJavaPlugins.java:367)
12-07 20:04:59.337 18524 28962 E AndroidRuntime: 	at io.reactivex.internal.schedulers.ScheduledRunnable.run(ScheduledRunnable.java:69)
12-07 20:04:59.337 18524 28962 E AndroidRuntime: 	at io.reactivex.internal.schedulers.ScheduledRunnable.call(ScheduledRunnable.java:57)
12-07 20:04:59.337 18524 28962 E AndroidRuntime: 	at java.util.concurrent.FutureTask.run(FutureTask.java:237)
12-07 20:04:59.337 18524 28962 E AndroidRuntime: 	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:272)
12-07 20:04:59.337 18524 28962 E AndroidRuntime: 	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
12-07 20:04:59.337 18524 28962 E AndroidRuntime: 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
12-07 20:04:59.337 18524 28962 E AndroidRuntime: 	at java.lang.Thread.run(Thread.java:761)
12-07 20:04:59.337 18524 28962 E AndroidRuntime: Caused by: java.lang.OutOfMemoryError: Failed to allocate a 96000012 byte allocation with 16777216 free bytes and 83MB until OOM
12-07 20:04:59.337 18524 28962 E AndroidRuntime: 	at fr.free.nrw.commons.utils.ImageUtils.checkIfImageIsDark(ImageUtils.java:117)
12-07 20:04:59.337 18524 28962 E AndroidRuntime: 	at fr.free.nrw.commons.utils.ImageUtils.checkIfImageIsTooDark(ImageUtils.java:88)
12-07 20:04:59.337 18524 28962 E AndroidRuntime: 	at fr.free.nrw.commons.upload.UploadModel$$Lambda$8.apply(Unknown Source)
12-07 20:04:59.337 18524 28962 E AndroidRuntime: 	at io.reactivex.internal.operators.single.SingleMap$MapSingleObserver.onSuccess(SingleMap.java:57)
12-07 20:04:59.337 18524 28962 E AndroidRuntime: 	at io.reactivex.internal.operators.single.SingleMap$MapSingleObserver.onSuccess(SingleMap.java:64)
12-07 20:04:59.337 18524 28962 E AndroidRuntime: 	at io.reactivex.internal.operators.single.SingleFromCallable.subscribeActual(SingleFromCallable.java:56)
12-07 20:04:59.337 18524 28962 E AndroidRuntime: 	at io.reactivex.Single.subscribe(Single.java:3394)
12-07 20:04:59.337 18524 28962 E AndroidRuntime: 	at io.reactivex.internal.operators.single.SingleMap.subscribeActual(SingleMap.java:34)
12-07 20:04:59.337 18524 28962 E AndroidRuntime: 	at io.reactivex.Single.subscribe(Single.java:3394)
12-07 20:04:59.337 18524 28962 E AndroidRuntime: 	at io.reactivex.internal.operators.single.SingleMap.subscribeActual(SingleMap.java:34)
12-07 20:04:59.337 18524 28962 E AndroidRuntime: 	at io.reactivex.Single.subscribe(Single.java:3394)
12-07 20:04:59.337 18524 28962 E AndroidRuntime: 	at io.reactivex.internal.operators.single.SingleZipArray.subscribeActual(SingleZipArray.java:64)
12-07 20:04:59.337 18524 28962 E AndroidRuntime: 	at io.reactivex.Single.subscribe(Single.java:3394)
12-07 20:04:59.337 18524 28962 E AndroidRuntime: 	at io.reactivex.Single.subscribe(Single.java:3380)
12-07 20:04:59.337 18524 28962 E AndroidRuntime: 	at io.reactivex.Single.subscribe(Single.java:3351)
12-07 20:04:59.337 18524 28962 E AndroidRuntime: 	at fr.free.nrw.commons.upload.UploadModel.receiveDirect(UploadModel.java:133)
12-07 20:04:59.337 18524 28962 E AndroidRuntime: 	at fr.free.nrw.commons.upload.UploadPresenter.lambda$receiveDirect$4$UploadPresenter(UploadPresenter.java:96)
12-07 20:04:59.337 18524 28962 E AndroidRuntime: 	at fr.free.nrw.commons.upload.UploadPresenter$$Lambda$3.run(Unknown Source)
12-07 20:04:59.337 18524 28962 E AndroidRuntime: 	at io.reactivex.internal.operators.completable.CompletableFromRunnable.subscribeActual(CompletableFromRunnable.java:35)
12-07 20:04:59.337 18524 28962 E AndroidRuntime: 	at io.reactivex.Completable.subscribe(Completable.java:2171)
12-07 20:04:59.337 18524 28962 E AndroidRuntime: 	at io.reactivex.internal.operators.completable.CompletableSubscribeOn$SubscribeOnObserver.run(CompletableSubscribeOn.java:64)
12-07 20:04:59.337 18524 28962 E AndroidRuntime: 	at io.reactivex.Scheduler$DisposeTask.run(Scheduler.java:579)
12-07 20:04:59.337 18524 28962 E AndroidRuntime: 	at io.reactivex.internal.schedulers.ScheduledRunnable.run(ScheduledRunnable.java:66)
12-07 20:04:59.337 18524 28962 E AndroidRuntime: 	... 6 more
12-07 20:04:59.346   786  7837 W ActivityManager:   Force finishing activity fr.free.nrw.commons/.upload.UploadActivity

Device and Android version:

LineageOS 2.7.1

Commons app version:

2.9.0 latest alpha

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:16 (11 by maintainers)

github_iconTop GitHub Comments

1reaction
nicolas-raoulcommented, Jan 4, 2019

This does not happen anymore, thanks for fixing, now I can upload my DSLR pictures 😃

0reactions
sivaraamcommented, Jan 12, 2019

Can you explain the pattern.

I think I already explained it. Anyways, when I try to upload an image with high resolutions (> 20 Mega Pixels (MP); not so large in size, though) the app crashes for me. Interestingly, the app does not crash for an image whose resolution is not so high (10.8MP) but the size is large (14MB) when compared to the images that crash.

So, the app seems to be crashing when I upload high resolution images (currently >23MP).

Read more comments on GitHub >

github_iconTop Results From Across the Web

java - Crash OutOfMemoryError when attempting to load large ...
java.lang.OutOfMemoryError happens in case of image loading. Because the phone memory has certain limitations. So instead of loading image ...
Read more >
Crash / restart due to OOM, when capturing a photo via <input ...
The app crashes/restarts when taking photos via file-input element (intermittently). Probably due to an out of memory (OOM) issue, where the ...
Read more >
Fixing the bugs: Running out of memory - Hacking with Swift
Loading the images was slow because they were so big, and iOS was caching them unnecessarily. But UIImage 's cache is intelligent: if...
Read more >
Terminated due to out of memory crashes - Apple Developer
Hi,. I'm building an ios app for iPad (swift 3) and keep getting crashes with the message 'Terminated due to out of memory'....
Read more >
OutOfMemoryError when decoding a bitmap byte array
It's an OutOfMemory error while decoding data to a Bitmap. You don't need the reproduce steps for fixing it. The problem happens when...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found