react-native-blob-util icon indicating copy to clipboard operation
react-native-blob-util copied to clipboard

[iOS] Memory usage not being clean after successful upload

Open kyoungnowcom opened this issue 3 years ago • 6 comments

Hi, when uploading a large amount of files using ReactNativeBlobUtil.fetch(), the memory usage will climb steadily and it will not get cleared up after each successful upload, even after the entire upload process gets completed with some wait time thereafter. And there were no other activities while conducting the test. See screenshot, sample code below. Any suggested changes to flush the memory or this is an expected behavior?

Any input will highly appreciated. Thank you!

  • Xcode profiler

https://drive.google.com/file/d/1_L8nzlYSR9YH_XWmVQzRXQ9zoG7LwW1x/view?usp=sharing

  • Version used:
  • "react-native-blob-util": "^0.16.2"
  • "react-native": "0.68.2"
  • Sample code snippet
const testUpload = async () => {
    const fileBasePath = RNBlobUtil.fs.dirs.DocumentDir.replace(
      /\/Documents$/,
      '/tmp/react-native-image-crop-picker/',
    );
    console.log('fileBasePath', fileBasePath);
    const imageFiles = await RNBlobUtil.fs.ls(fileBasePath);

    for (let i = 0; i < imageFiles.length; i++) {
      const filePath = fileBasePath + imageFiles[i];
      try {
        await RNBlobUtil.config({
          fileCache: false,
        }).fetch(
          'PUT',
          'https://<subdomain>.blob.core.windows.net/<params>',
          {
            'x-ms-version': '2020-02-10',
            'x-ms-blob-type': 'BlockBlob',
            'x-ms-meta-IsPublic': 'true',
          },
          RNBlobUtil.wrap(
            Platform.OS === 'ios'
              ? filePath!.replace('file://', '')
              : filePath!,
          ),
        );
        console.log('uploaded ' + i + ',' + filePath);
      } catch (error) {
        console.error('error on ' + i, error);
      }
    }
  };

kyoungnowcom avatar Aug 16 '22 19:08 kyoungnowcom

heyy @RonRadtke, any updates regarding this issue?

kelly-torum avatar Feb 27 '23 09:02 kelly-torum

any update on this

H4mxa avatar Oct 02 '23 10:10 H4mxa

any update issue still persist

Keanu2431 avatar Mar 03 '24 07:03 Keanu2431

I'm still experiencing this issue. Start out with 470MB, end up with 900MB memory taken.

GunnarAK avatar Jul 01 '24 13:07 GunnarAK