capawesome-team / capacitor-plugins

⚡️ Community plugins for Capacitor. Supports Android, iOS and the Web.
https://capawesome.io/plugins/
172 stars 25 forks source link

bug: When I try to upload a large number of photos, I get an error in the log: "Failed to allocate a 150994960 byte allocation with 25165824 free bytes and 44MB until OOM, target footprint 247164272, growth limit 268435456." #156

Closed DmitryRazhkou closed 2 months ago

DmitryRazhkou commented 2 months ago

Plugin(s)

Version

5.3.0

Platform(s)

Current behavior

When I try to upload a large number of photos, I get an error in the log: "Failed to allocate a 150994960 byte allocation with 25165824 free bytes and 44MB until OOM, target footprint 247164272, growth limit 268435456."

Expected behavior

Need to have a possibility to catch this error in my react function: const fileInputHandler = useCallback(async () => { try { const result = await FilePicker.pickImages({ multiple: true, readData: true }); ...

Now when I do this, I can't catch the error in catch block

Reproduction

.

Steps to reproduce

.

Other information

No response

Capacitor doctor

.

Before submitting

robingenz commented 2 months ago

You should not use the readData option for large files. You can either use the fetch API to load a blob or you can use a Capacitor plugin to upload the files directly from the native layer. You can find more information here: The File Handling Guide for Capacitor

Since this is not a bug, I am closing this issue.