Skip to content

🐛 Bug Report: Storage getFileDownload fails for big file (1GB) due to OutOfMemoryError #44

Closed

Description

@joern-h

👟 Reproduction steps

Download a big file (1GB) with getFileDownload

👍 Expected behavior

It should download the file.

There is a client.chunkedUpload i guess we also need a client.chunkedDownload

👎 Actual Behavior

Throws java.lang.OutOfMemoryError:

AndroidRuntime  E  FATAL EXCEPTION: OkHttp Dispatcher
                E  java.lang.OutOfMemoryError: Failed to allocate a 268435472 byte allocation with 6275072 free bytes and 124MB until OOM, target footprint 143753320, growth limit 268435456
                E      at java.util.Arrays.copyOf(Arrays.java:3161)
                E      at java.io.ByteArrayOutputStream.grow(ByteArrayOutputStream.java:118)
                E      at java.io.ByteArrayOutputStream.ensureCapacity(ByteArrayOutputStream.java:93)
                E      at java.io.ByteArrayOutputStream.write(ByteArrayOutputStream.java:153)
                E      at kotlin.io.ByteStreamsKt.copyTo(IOStreams.kt:108)
                E      at kotlin.io.ByteStreamsKt.copyTo$default(IOStreams.kt:103)
                E      at kotlin.io.ByteStreamsKt.readBytes(IOStreams.kt:136)
                E      at io.appwrite.Client$awaitResponse$2$1.onResponse(Client.kt:511)
                E      at okhttp3.internal.connection.RealCall$AsyncCall.run(RealCall.kt:519)
                E      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
                E      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
                E      at java.lang.Thread.run(Thread.java:919)

🎲 Appwrite version

Version 1.4.x

💻 Operating system

Linux

🧱 Your Environment

Appwrite 1.4.5
sdk-for-android:4.0.0

👀 Have you spent some time to check if this issue has been raised before?

  • I checked and didn't find similar issue

🏢 Have you read the Code of Conduct?

Activity

  1. added
    bug
    on Oct 11, 2023
  2. added a commit that references this issue on Oct 11, 2023
    60d10be
  3. self-assigned this
    on Dec 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bug

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions