tus / tus-android-client

The tus client for Android.
https://tus.io/
161 stars 46 forks source link

OutOfMemory During large file upload #22

Closed AnkanDey closed 6 years ago

AnkanDey commented 6 years ago

Hello,

I am facing problem when try to upload Large Video file(250MB approx). I am getting OutOfMemory exception after some time of upload start. Although this problem is not happening for small size files. Below is the stack Trace

Caused by: java.lang.OutOfMemoryError: Failed to allocate a 536870924 byte allocation with 16773216 free bytes and 252MB until OOM

Any help is appreciated.

Acconut commented 6 years ago

Hi there, I already have an idea what might cause this problem. Please attach your code responsible for uploading so I can check it.

AnkanDey commented 6 years ago

Hello There,

Thanks for replying. Below sample code provided.

MainActivity.txt

Acconut commented 6 years ago

Apologies for my delayed response, I had a few private tasks to take care of. The idea that I had is not the cause for the problem, I need to investigate this. Are you using an unmodified example from this repository?

AnkanDey commented 6 years ago

Hi,

Yes. I am using unmodified example from the repo.

AnkanDey commented 6 years ago

Hello there,

Is there any solution you found? I still stuck here. Please update me if you have any solution.

Thanks.

Acconut commented 6 years ago

Sorry, I didn't had the time to look into this yet. Hopefully I will be able to do so in the next days.

Acconut commented 6 years ago

Ok, I am able to reproduce the issue locally. Let me dig further into it.

Acconut commented 6 years ago

Ok, I found a solution for it. The problem was that the default payload size was too big for mobile devices. This setting caused tus-android-client to hold the entire upload in memory and if you have a 200MB upload this will cause a OOM-error. By lowering this setting we were able to prevent this issue. Please update tus-android-client to 0.1.7 to obtain the fix.

AnkanDey commented 5 years ago

Thank you. I tried couple of time with large file size. And it works.