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

Memory leak storing files > 20 MB

    XMLWordPrintableJSON

Details

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

    Description

      Repro steps:

      1. Download a file larger than 20 MB
      2. Store it in local device using Cordova-file-api (any version)
      3. When testing in Android device, the app crashes when writting the file blob

      Logcat output:

      E AndroidRuntime: java.lang.OutOfMemoryError: Failed to allocate a 53011102 byte allocation with 16777216 free bytes and 49MB until OOM
      02-15 09:54:04.274 19648 19693 E AndroidRuntime: at java.lang.StringFactory.newStringFromChars(Native Method)
      02-15 09:54:04.274 19648 19693 E AndroidRuntime: at java.lang.AbstractStringBuilder.toString(AbstractStringBuilder.java:629)
      02-15 09:54:04.274 19648 19693 E AndroidRuntime: at java.lang.StringBuilder.toString(StringBuilder.java:663)
      02-15 09:54:04.274 19648 19693 E AndroidRuntime: at org.json.JSONTokener.nextString(JSONTokener.java:211)
      02-15 09:54:04.274 19648 19693 E AndroidRuntime: at org.json.JSONTokener.nextValue(JSONTokener.java:107)
      02-15 09:54:04.274 19648 19693 E AndroidRuntime: at org.json.JSONTokener.readArray(JSONTokener.java:429)
      02-15 09:54:04.274 19648 19693 E AndroidRuntime: at org.json.JSONTokener.nextValue(JSONTokener.java:103)
      02-15 09:54:04.274 19648 19693 E AndroidRuntime: at org.json.JSONArray.<init>(JSONArray.java:92)
      02-15 09:54:04.274 19648 19693 E AndroidRuntime: at org.json.JSONArray.<init>(JSONArray.java:108)
      02-15 09:54:04.274 19648 19693 E AndroidRuntime: at org.apache.cordova.file.FileUtils$25.run(FileUtils.java:565)
      02-15 09:54:04.274 19648 19693 E AndroidRuntime: at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
      02-15 09:54:04.274 19648 19693 E AndroidRuntime: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
      02-15 09:54:04.274 19648 19693 E AndroidRuntime: at java.lang.Thread.run(Thread.java:818)
      02-15 09:54:04.276 600 2324 W ActivityManager: Force finishing activity MainActivity

      Attachments

        Activity

          People

            Unassigned Unassigned
            luis.c.oliveira@gmail.com L Carvalho
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: