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

Plugin 'CDVCamera' has a pending operation, memory purge is delayed for didReceiveMemoryWarning.

    XMLWordPrintableJSON

Details

    Description

      The application is crashing only when multiple pictures are taken. There is a memory error in the logs. I'm using the cordova camera plugin: https://github.com/apache/cordova-plugin-camera

      The crash doesn't happen during the picture taking, but shortly after. If I don't take the pictures, the application doesn't crash. At this point, I'm assuming the memory is being filled up, and CDVCamera isn't crashing - however, it's also not releasing memory - so the next memory intensive task that is performed crashes the application.

      I searched through the existing JIRA issues - here is what i found:

      CB-1751 (Feature - Resolved) is related to someone writing a new plugin. I am using the existing plugin.
      CB-975 - (Bug - Reopened) Lorin Asked:

      Could you share any memory profiling data you've collected?

      I will be happy to provide memory profiling data, but I'm not sure how to collect it. If you could provide some guidance, I will gather the information.
      CB-391 (Bug - Resolved) - I'm not sure this applies.

      The application log from XCode
      Note: the line '--- Camera Success ----' indicates that a picture was taken.

      2014-01-06 17:12:05.434 ESA Mobile[38556:60b] Received memory warning.
      2014-01-06 17:12:05.490 ESA Mobile[38556:60b] Plugin 'CDVCamera' has a pending operation, memory purge is delayed for didReceiveMemoryWarning.
      2014-01-06 17:12:15.720 ESA Mobile[38556:60b] ---- Camera Success ----
      2014-01-06 17:12:18.378 ESA Mobile[38556:60b] Received memory warning.
      2014-01-06 17:12:18.442 ESA Mobile[38556:60b] Plugin 'CDVCamera' has a pending operation, memory purge is delayed for didReceiveMemoryWarning.
      2014-01-06 17:12:24.182 ESA Mobile[38556:60b] ---- Camera Success ----
      2014-01-06 17:12:29.027 ESA Mobile[38556:60b] Received memory warning.
      2014-01-06 17:12:29.082 ESA Mobile[38556:60b] Plugin 'CDVCamera' has a pending operation, memory purge is delayed for didReceiveMemoryWarning.
      2014-01-06 17:12:32.121 ESA Mobile[38556:60b] Received memory warning.
      2014-01-06 17:12:33.896 ESA Mobile[38556:60b] ---- Camera Success ----
      2014-01-06 17:12:40.399 ESA Mobile[38556:60b] Received memory warning.
      2014-01-06 17:12:40.433 ESA Mobile[38556:60b] Plugin 'CDVCamera' has a pending operation, memory purge is delayed for didReceiveMemoryWarning.
      2014-01-06 17:12:43.129 ESA Mobile[38556:60b] Received memory warning.
      2014-01-06 17:12:44.595 ESA Mobile[38556:60b] ---- Camera Success ----
      2014-01-06 17:12:49.852 ESA Mobile[38556:60b] Received memory warning.
      2014-01-06 17:12:49.886 ESA Mobile[38556:60b] Plugin 'CDVCamera' has a pending operation, memory purge is delayed for didReceiveMemoryWarning.
      2014-01-06 17:12:50.607 ESA Mobile[38556:60b] Received memory warning.
      2014-01-06 17:12:50.648 ESA Mobile[38556:60b] Plugin 'CDVCamera' has a pending operation, memory purge is delayed for didReceiveMemoryWarning.
      2014-01-06 17:12:50.651 ESA Mobile[38556:60b] Received memory warning.
      2014-01-06 17:12:50.684 ESA Mobile[38556:60b] Plugin 'CDVCamera' has a pending operation, memory purge is delayed for didReceiveMemoryWarning.
      2014-01-06 17:12:53.967 ESA Mobile[38556:60b] ---- Camera Success ----
      2014-01-06 17:12:59.417 ESA Mobile[38556:60b] Received memory warning.
      2014-01-06 17:12:59.464 ESA Mobile[38556:60b] Plugin 'CDVCamera' has a pending operation, memory purge is delayed for didReceiveMemoryWarning.
      2014-01-06 17:13:00.491 ESA Mobile[38556:60b] Received memory warning.
      2014-01-06 17:13:00.535 ESA Mobile[38556:60b] Plugin 'CDVCamera' has a pending operation, memory purge is delayed for didReceiveMemoryWarning.
      2014-01-06 17:13:00.713 ESA Mobile[38556:60b] Received memory warning.
      2014-01-06 17:13:00.755 ESA Mobile[38556:60b] Plugin 'CDVCamera' has a pending operation, memory purge is delayed for didReceiveMemoryWarning.
      2014-01-06 17:13:03.841 ESA Mobile[38556:60b] ---- Camera Success ----
      2014-01-06 17:13:09.368 ESA Mobile[38556:60b] Received memory warning.
      2014-01-06 17:13:09.419 ESA Mobile[38556:60b] Plugin 'CDVCamera' has a pending operation, memory purge is delayed for didReceiveMemoryWarning.
      2014-01-06 17:13:11.056 ESA Mobile[38556:60b] Received memory warning.
      2014-01-06 17:13:11.091 ESA Mobile[38556:60b] Plugin 'CDVCamera' has a pending operation, memory purge is delayed for didReceiveMemoryWarning.
      2014-01-06 17:13:11.241 ESA Mobile[38556:60b] Received memory warning.
      2014-01-06 17:13:11.275 ESA Mobile[38556:60b] Plugin 'CDVCamera' has a pending operation, memory purge is delayed for didReceiveMemoryWarning.
      2014-01-06 17:13:14.544 ESA Mobile[38556:60b] ---- Camera Success ----
      2014-01-06 17:13:15.986 ESA Mobile[38556:60b] Received memory warning.

      The crash report obtained from iTunes

      Incident Identifier: F1917304-FBC6-4278-86A5-04CFD0D1AFC6
      CrashReporter Key:   6c8c459edbbe6e7d2bb1e74cef9c93d838307e20
      Hardware Model:      iPad4,1
      OS Version:          iPhone OS 7.0.3 (11B511)
      Kernel Version:      Darwin Kernel Version 14.0.0: Fri Sep 27 23:08:32 PDT 2013; root:xnu-2423.3.12~1/RELEASE_ARM64_S5L8960X
      Date:                2014-01-06 17:14:50 -0800
      Time since snapshot: 101 ms
      
      Free pages:                              44512
      Active pages:                            106902
      Inactive pages:                          39358
      Speculative pages:                       6656
      Throttled pages:                         0
      Purgeable pages:                         25
      Wired pages:                             37450
      File-backed pages:                       27188
      Anonymous pages:                         125728
      Compressions:                            477806
      Decompressions:                          106966
      Compressor Size:                         21463
      Uncompressed Pages in Compressor:        85378
      Largest process:   ESA Mobile
      
      Processes
           Name                    <UUID>                       rpages       recent_max   fds      [reason]          (state)
      
         wirelessproxd <9f112d11a5f734019013a43e9fc677a9>          188              188  200                      (daemon) (idle)
                  tccd <a4190e0e6f6b3d23b06326c8935a5bb4>          185              185  200                      (daemon)
                   kbd <4350c1efc23b3182809fcb6d8a7885fd>         1259             1259  200                      (daemon)
            ESA Mobile <18c89bdf1b40339697d042bb287713ee>       179200           179200  200  [per-process-limit] (frontmost) (resume)
                  ptpd <872030b325d9383b95a5434d41f77b25>         1077             1077  200                      (daemon)
      identityservices <cd1fff47d6ad3b0f85cdc5fb39d8b53e>          400              400  100                      (daemon)
               imagent <5080234127f5363fb539ffc3965af6e2>          286              286   50                      (daemon)
                 wifid <ca4f06468bf03d0f8847089e8cd320f1>         1030             1030   50                      (daemon)
                powerd <a1fc82c399dc36e2b18a6fbb3d936a88>          158              158  100                      (daemon)
          mediaserverd <f067d4c2a21a30fbabab30d9c94ccbd3>         4314             4314   50                      (daemon)
         iaptransportd <4c622f6c4295395997e7a6ec783b4623>          265              265  100                      (daemon)
         mDNSResponder <2b8ad561938f3fc0a6255b607f503040>          298              298  100                      (daemon)
                  apsd <ceb7855af3a63c2682fab13d5e0aeb82>          835              835  100                      (daemon)
          mediaremoted <4734e15435133a48bdba8714c6b14782>          281              281  100                      (daemon)
            calaccessd <d6960604dc2c37499cd597b510055d7e>          961              961  200                      (daemon)
          itunesstored <0d023473a4a93c93a531210de784b155>         2488             2488  200                      (daemon)
               syslogd <5c3a246617d3399e977efc84c2e29df2>         1741             1741  200                      (daemon)
             locationd <10f268a18d5d3343ab21be48bb005ecf>         5971             5971  200                      (daemon)
              sharingd <550630f3f5dc3f0aa08ba04876d82e6d>          682              682  200                      (daemon)
                voiced <baad1d590ec8344385d046dacfa431da>          290              290  200                      (daemon)
          syslog_relay <773c693446c6346f9aa3fa3b56388ffb>          112              112  200                      (daemon)
           SpringBoard <fe632b47e4ee342baf4b3701cd11b242>        21698            21698   50                     
            backboardd <2f84882cf3693dfb921f4e0d38966f50>        23995            23995   50                      (daemon)
             fseventsd <a0223d346d4431a5ba1caabf8505b40e>          792              792   50                      (daemon)
             lockdownd <e280cf66209e3be980809a7d93eea76e>          594              594   50                      (daemon)
               configd <bb6e02e801a93ef896f2f3cf5cbb00fe>          739              739   50                      (daemon)
          fairplayd.A2 <f788338420e63532960518b7b1333967>          146              146  100                      (daemon)
            aggregated <6189b3e3d0c83a879b99cf7cd566dffb>          670              670  100                      (daemon)
              BTServer <3669aefbfb2e3577b17bde9598feda76>         1671             1671  100                      (daemon)
             distnoted <c40569cbea09312b9310bc74cbc88e29>          438              438  100                      (daemon)
        UserEventAgent <0d33b64c0c003a65b9a87c6622921781>         1267             1267   50                      (daemon)
              networkd <c7aa87e0c2d33d379a09598281a5e3ee>          707              707  100                      (daemon)
          itunescloudd <b5212676352c3730a6790fc982cb9c27>          775              775  100                      (daemon)
      filecoordination <72a4cec360d435c09cb83d2316317288>          220              220  200                      (daemon)
      EscrowSecurityAl <e14ee8c5bc0f3447b6cdaad44ab402da>          231              231  200                      (daemon)
           touchsetupd <0c315f01ae8d3675ad1a4eda4c9b18bb>          207              207  200                      (daemon)
      notification_pro <72244e97bc7d33408cd01f8c7fb7d2eb>          147              147  100                      (daemon)
      XcodeDeviceMonit <2da714a41fbd33e59d392c0fb1667024>          297              297  200                      (daemon)
                   ubd <231dc91e9b11307eb98874f9bbfaa86c>          406              406  200                      (daemon)
           debugserver <756146181af631a9b08c7e3c8525c41d>          207              207  200                      (daemon)
                cplogd <96828e7047bf36e2a1cdffcc1be700f8>          142              142  200                      (daemon)
      CommCenterClassi <43ec18e4391c3f58a157849cda0d61e0>          511              511   50                      (daemon)
               notifyd <bd919e93d6293562af0b7ec0e21247a0>          260              260  100                      (daemon)
      
      **End**
      

      The relevant code

                      /**
                       * Phonegap camera.getPicture callback function - SUCCESS
                       */
                      var onSuccess = function (imageData) {
                          console.log("---- Camera Success ----");
                          var document = {
                              Type: {
                                  Id: $scope.documentType.Value,
                                  Name: Config.formSettings.DocumentTypes[$scope.documentType.Value - 1].Key
                              },
                              Base64: imageData
                          }
      
                          $scope.$apply(function () {
                              $scope.EnrollmentService.Documents.push(document);
                          });
                      }
      
                      /**
                       * Phonegap camera.getPicture callback function - FAIL
                       */
                      var onFail = function (message) {
                          console.log("---- Camera Fail ----");
                          console.log(message);
                      }
      
                      /**
                       * Take the picture
                       */
                      navigator.camera.getPicture(onSuccess, onFail, { quality: 50,
                          destinationType: Camera.DestinationType.DATA_URL
                      });

      Attachments

        Activity

          People

            Unassigned Unassigned
            bzitzow Brian Zitzow
            Votes:
            1 Vote for this issue
            Watchers:
            8 Start watching this issue

            Dates

              Created:
              Updated: