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 when uploading file

See original GitHub issue

Hi 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:closed
  • Created 5 years ago
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
franciscoaguirrecommented, Feb 15, 2019

I checked and it works now! Thanks! Closing the issue

0reactions
SleeplessBytecommented, Feb 15, 2019

Thank you for taking the time to check this @franciscoaguirre

Read more comments on GitHub >

github_iconTop 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 >

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