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

File upload loads entire file in to memory. #54

Open
luke-stead-sonocent opened this issue Nov 24, 2023 · 0 comments
Open

File upload loads entire file in to memory. #54

luke-stead-sonocent opened this issue Nov 24, 2023 · 0 comments

Comments

@luke-stead-sonocent
Copy link

Uploading a file with the following code causes the entire file to be loaded in to memory.
CloudConvertClient().importUsing().upload(UploadImportRequest(), file)

It looks like the file is being converted in to an input stream in getMultipartHttpEntity.getMultipartHttpEntity(). Because of this, the entire file is being read out into memory in BufferedHttpEntity, as InputStreamBodys have a contentLength of -1.

There's a note that you're using an InputStreamBody and not a FileBody because it causes the async client to fail with ContentTooLongException. If this can't be worked around, it could instead be fixed just for the non-async client?

Below are two images showing the memory spiking, and then being retained, on uploading a 200MB file. The memory is GC'd after the upload has finished.

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

1 participant