Uploaded image for project: 'Apache Cordova'
  1. Apache Cordova
  2. CB-8332

Memory leak in loading files from disk with file plugin

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 3.5.0
    • None
    • cordova-plugin-file
    • iOS

    Description

      When loading files from disk, the file plugin appears to leak memory. Using instruments it can be narrowed down to -[CDVFilesystemURLProtocol startLoading], which is in CDVFile.m on line 150.
      (https://github.com/apache/cordova-plugin-file/blob/967ca4d848d6bea0bad5a0d334b8d9f1ea2c4680/src/ios/CDVFile.m#L150)

      To reproduce:
      • have the iOS app download a file using plugin-file-transfer
      • store that file to persistent storage
      • load that file from disk and the app will leak

      We have a very simple proof of concept that downloads a large photo, then constantly refreshes an iFrame which triggers loading the photo from persistent storage. The memory usage of the app climbs over time (with various dips at memory warnings), then crashes due to memory pressure. We can upload this sample project/provide a link if needed – there doesn’t appear to be a way to attach files.

      Attachments

        Activity

          People

            Unassigned Unassigned
            patr Patrick Richards
            Votes:
            2 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

              Created:
              Updated: