Files
react-native/packages
AjitandFacebook GitHub Bot 81e47af764 fix performance and memory usage of creating blob on Android (#50121)
Summary:
This PR fixes https://github.com/facebook/react-native/issues/48657
- Memory usage for creating a blob lowered from _( nearest 2^N greater than the file size)+1KB_ previously To _(file size)+1KB_. This is achieved by avoiding internal calls to java.io.ByteArrayOutputStream.ensureCapacity by creating a buffer based on file size.
- Increases the max file size a Blob can be  created from before hitting a OutOfMemoryException.
- Major performance increase by avoiding buffer copying

## Changelog:

[ANDROID] [CHANGED] - Speed and Memory usage improvements to Android Blob support
[ANDROID] [FIXED] - Creating of Blobs from large files now works. File size can now be upto available (free) heap size.

Pull Request resolved: https://github.com/facebook/react-native/pull/50121

Test Plan: Used the App here to test Android Blob creation. https://github.com/giantslogik/blob-large-file-fetch.

Reviewed By: cortinico

Differential Revision: D71464835

Pulled By: javache

fbshipit-source-id: 38de7d83bcaee265fc6e7183f6b1160027cd4cb2
2025-03-19 06:03:26 -07:00
..