OutOfMemoryError while uploading videos
See original GitHub issueIssue: The SDK throws an OutOfMemoryError when I try to upload videos that are larger than 50MB in size SDK Version: v1.2.2 Android Version: All versions Device: All devices Video file size: 65MB Logs:
Throwing OutOfMemoryError "Failed to allocate a 2060 byte allocation with 1380 free bytes and 1380B until OOM"
FATAL EXCEPTION: RxIoScheduler-3
Process: my.package.name, PID: 5028
java.lang.IllegalStateException: Fatal Exception thrown on Scheduler.Worker thread.
at rx.internal.schedulers.ScheduledAction.run(ScheduledAction.java:59)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:422)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:152)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:265)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
at java.lang.Thread.run(Thread.java:818)
Caused by: java.lang.OutOfMemoryError: Failed to allocate a 2060 byte allocation with 1380 free bytes and 1380B until OOM
at com.android.okio.Segment.<init>(Segment.java:34)
at com.android.okio.SegmentPool.take(SegmentPool.java:48)
at com.android.okio.OkBuffer.writableSegment(OkBuffer.java:511)
at com.android.okio.OkBuffer.write(OkBuffer.java:424)
at com.android.okio.OkBuffer.clone(OkBuffer.java:740)
at com.android.okhttp.internal.http.RetryableSink.writeToSocket(RetryableSink.java:77)
at com.android.okhttp.internal.http.HttpConnection.writeRequestBody(HttpConnection.java:240)
at com.android.okhttp.internal.http.HttpTransport.writeRequestBody(HttpTransport.java:77)
at com.android.okhttp.internal.http.HttpEngine.readResponse(HttpEngine.java:622)
at com.android.okhttp.internal.http.HttpURLConnectionImpl.execute(HttpURLConnectionImpl.java:388)
at com.android.okhttp.internal.http.HttpURLConnectionImpl.getResponse(HttpURLConnectionImpl.java:332)
at com.android.okhttp.internal.http.HttpURLConnectionImpl.getResponseCode(HttpURLConnectionImpl.java:500)
at com.android.okhttp.internal.http.DelegatingHttpsURLConnection.getResponseCode(DelegatingHttpsURLConnection.java:105)
at com.android.okhttp.internal.http.HttpsURLConnectionImpl.getResponseCode(HttpsURLConnectionImpl.java:25)
at com.cloudinary.android.UploaderStrategy.callApi(UploaderStrategy.java:81)
at com.cloudinary.Uploader.callApi(Uploader.java:22)
at com.cloudinary.Uploader.upload(Uploader.java:55)
at my.package.name.common.utils.CloudinaryUtils.uploadMediaInternal(CloudinaryUtils.java:106)
at my.package.name.common.utils.CloudinaryUtils.lambda$uploadMedia$0(CloudinaryUtils.java:90)
at my.package.name.common.utils.CloudinaryUtils.access$lambda$0(CloudinaryUtils.java:0)
at my.package.name.common.utils.CloudinaryUtils$$Lambda$1.call(Unknown Source)
at rx.Observable.unsafeSubscribe(Observable.java:9860)
at rx.internal.operators.OperatorSubscribeOn$1.call(OperatorSubscribeOn.java:94)
at rx.internal.schedulers.CachedThreadScheduler$EventLoopWorker$1.call(CachedThreadScheduler.java:221)
at rx.internal.schedulers.ScheduledAction.run(ScheduledAction.java:55)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:422)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:152)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:265)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
at java.lang.Thread.run(Thread.java:818)
Issue Analytics
- State:
- Created 7 years ago
- Comments:5 (1 by maintainers)
Top Results From Across the Web
OutOfMemoryError while uploading video - how best to chunk?
While trying to upload a video in Android, I'm reading it into memory, and if the video is large I get an OutOfMemoryError....
Read more >OutOfMemoryError while uploading video – how best to chunk
While trying to upload a video in Android, I'm reading it into memory, and if the video is large I get an OutOfMemoryError....
Read more >Out of Memory Error When Uploading Large Files Through ...
I have some javascript that sends two videos to the handler.ashx page, then performs the upload. It works fine on smaller files, ...
Read more >how best to transfer large video files into a byte array?
Discussion: OutOfMemoryError: how best to transfer large video files into a byte array? Anna PS. 13 years ago. Permalink.
Read more >java.lang.OutOfMemoryError multipart file upload - Bugs Report
I'm receiving an out heap space memory error when calling a multipart file upload of 2GB file. The same test works in postman....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
You can try to allocate a larger heap for you app -
<application android:largeHeap="true"> </application>
Note that it can also happen as a result of a memory leak. There is some useful info and additional reading materials in this S.O answer.
Let me know of any updates.
Thank you, Mustafa, for making this contribution. We will review this and release a fix accordingly.