OutOfMemoryError when uploading file
See original GitHub issueHi everyone!
I am trying to upload a video in android using Fuel. Everything works fine for small videos but for large ones I get an OutOfMemoryError. The upload appears to happen until a certain point (seen in the progress bar), then the error is thrown and it stops. I saw a similar issue related to downloading files and tried to fix the error based on it but unfortunately couldn’t.
Code:
Fuel.upload("/videos")
.source { request, url -> videoFile }
.name { "video" }
.progress { readBytes, totalBytes ->
if (totalBytes.toFloat() != 0f) {
val progress = readBytes.toFloat() / totalBytes.toFloat() * 100
runOnUiThread { progressBar.progress = progress.toInt() }
}
}
.responseJson { request, response, result ->
result.fold(
success = { json -> "Done!" },
failure = { error -> Log.e("Failure", error.toString()) }
)
}
Any help would be gladly appreciated!
Issue Analytics
- State:
- Created 5 years ago
- Comments:6 (1 by maintainers)
Top Results From Across the Web
How to avoid OutOfMemoryError uploading file? - java
When an allocation exceeds the maximum heap it might try to release any soft / weak references and other disposable resources, force a...
Read more >Java heap space error by posting large file (200MB) through ...
Hi Mendix people, I have a problem when using a rest call to post a file of 200MB to an other system. Locally,...
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 >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 >Java heap space" exceptions when uploading large ...
lang.OutOfMemoryError: Java heap space".? The exact document size when this issue may be encounter this issue depends on system configuration ...
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
I checked and it works now! Thanks! Closing the issue
Thank you for taking the time to check this @franciscoaguirre