Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

File upload loads entire file in to memory. #54

Copy link
Copy link
@luke-stead-sonocent

Description

@luke-stead-sonocent
Issue body actions

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
Reactions are currently unavailable

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.