Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How does multipart handle large byte arrays? #3553

Open
ardevd opened this issue Apr 30, 2021 · 1 comment
Open

How does multipart handle large byte arrays? #3553

ardevd opened this issue Apr 30, 2021 · 1 comment

Comments

@ardevd
Copy link

ardevd commented Apr 30, 2021

From my app I'm trying to upload a chunk of data. The app generates a byte array of the data to be uploaded and passes it to the Retrofit request. I've noticed that when I do so the data seems to be copied in memory resulting in twice the memory consumption. A 30 MB data blob turns into 60 mb in memory once it's passed to the POST request with retrofit.

I then tried to migrate to a @Multipart request but that didnt seem to make any difference.

Could someone enlighten me on the best way to do this? Do multipart requests make any sense in this scenario?

@JakeWharton
Copy link
Member

Retrofit currently buffers all request data, yes. We don't have a good workaround here, especially not for a composite request such a multipart.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants