Start a new topic

Memory Leak/Crash on iOS

Memory Leak/Crash on iOS

1 person has this problem


Hi Andreas, thanks for your message but I'm afraid the crash is not generating a log in the device. I did run it from xCode (several times) and even kept it running tethered to the computer until the crash but no crash shows in the device logs as you can see in the print screen attached

All, sharing test results from our side. Hope this helps to find the root cause

* we thought that our app got into memory problems because objects were not destroyed properly. So after scanning multiple times the app would crash.

* our app is based on basiconclickrecognition and it calles an api to get content and then shows that content

However, when we remove the api and only execute the cloud object recognition the app ALSO crashes. On iOS it freezes. On Android it crashes (after we scan around 30 times)

We use: Version 5.1.1-3.2.1 CORDOVA

But when we load our project via the Wikitude app it also crashes (and even performs worse)

PS: when we downgrade to previous Wikitude version the Android app crashes after around 70 scans

@Gerrit: What kind of augmentations have you defined? Images, videos, 3D models?

 

We are aware of the problem and have given the bug a high priority. Please give us a few a little time so that we can identify the issue and deliver a bug fix.

THX

Best regards

Andreas

For all of you who experienced application crashes due to memory preassure in combination with video drawables: please write to info@wikitude.com to get early access to our latest PhoneGap plugin which should fix the issue. An official release will follow in the next couple of days.

Best regards

Andreas

Hi everybody. Has anyone had any luck with this bug fix Andreas posted? I'm afraid to say we haven't. I downloaded the plugin, replaced the files, put our licence and the app worked exactly the same as before, that is it still crashes. It crashes in just the same way as before. if the target augments one image it crashes after 16 times. If there are two it crashes after eight if it augments a video it crashes much earlier. As Andreas said in the post that it was a problem with the video drawables I even removed all the video drawables. The app is creating none but the result is the same even if there's only image drawables. Well unforunately this is our feedback up to now, we're waiting to hear from you guys, regards:

 

Axel

Hi Axel,
Can you send us a demo project with which we can reproduce the issue? I would really like to have a closer look at this.

Best regards

Andreas

The latest phonegap plugin did not fix it for us either.

We only use the CloudTracker class without any drawables, pure the recognition of a target as test.
This crashes after ±8x in iOs and a bit longer for Android.

Our workaround was making use of AR.context.destroyAll() after each scan.
This works but you will need to recreate the tracker again and no augmentation being defined.

After AR.context.destroyAll() is being called the method cloudTracker.isLoaded() will never get set to true

 

World.cloudTracker = new AR.CloudTracker("__your_authentication_token__", "__target_collection_id__", {
onLoaded: World.trackerLoaded,
onError: World.trackerError
});

trackerLoaded: function trackerLoadedFn() {
console.log(World.cloudTracker.isLoaded());//always false after AR.context.destroyAll()
}



if using World.cloudTracker.destroy(); this crashes the app immediately.

So our AR is only working the first time and won't work after destroyall.
I can send you a sample project but this is really easy to reproduce.


Best regards,

Sang.

Hi, sure, you can clone the gitub repo at 

 

https://github.com/axelweisz/support.git

 

It augments some images of our own but you can test it using two of the images of your sample apps, the oune eith the guy with the surfboard and the other of the racer guy that augments an helmet 

 

regards:

 

Axel

Hi, guys, total disclosure here, the code below is working. We were kind of desperate here so I traced all our stps back and I found a code that works for image as well as video augmentation, I tested several times and it augmented the targets more than 4 times without crashing. The main difference about the bugged code is that in it I would create everithing from inside the onEnterFieldOfVision as it was recommended to me by wikitude, but of course I'm not sure that that is the real issue, I just hope I'm contributing with you guys:

 

createOverlays: function createOverlaysFn() {

 

var baseUrl = 'http://bedj.com.br/seebeyond/';

 

/************************ LOOP IMG ************************/

this.tracker01 = new AR.ClientTracker(baseUrl+"allTrackers.wtc", {

onLoaded: this.worldLoaded

});

 

var imgTgtsArray = ;

var imgsArray = ;

World.imgOverlays = ;

 

for (var i = 0; i<imgTgtsArray.length; i++){

var imgRes = new AR.ImageResource(imgsArray); 

World.imgOverlays = new AR.ImageDrawable(imgRes, 1, {

offsetX: 0,

offsetY: 0

}

);

var aumentaImg = new AR.Trackable2DObject(this.tracker01,  imgTgtsArray, {

drawables: {

cam:

}

});

}

 

/************************ LOOP VIDEO ************************/

 

 var videoTgtsArray = ;

      var videoArray = ;

      World.videoOverlays = ;

      World.trackables = ;

      for (var i = 0; i<videoTgtsArray.length; i++){

         World.videoOverlays = new AR.VideoDrawable(videoArray, 0.40, {

            offsetY: -0.3

         });

    World.trackables = new AR.Trackable2DObject(this.tracker01, videoTgtsArray, {

    drawables: {

      cam:

    },

    onEnterFieldOfVision: (function (ii) {

                       return function(e) {

                          World.videoOverlays.play(-1)

                       };

             })(i),

             onExitFieldOfVision: (function (ii) {

return function(e) {

World.videoOverlays.pause()

};

})(i)

    });

      }

},

 

 

I fave only 4 targets, 2 that augment an image an 2 that augment a video. I'm going to create a target collection with like 20 targets to see what happens, I'll keep you guys informed and please keep us informed about any other developments in this issue, regards:

 

Axel

Hi Guys,
We're talking about several topics here.

* CloudTracker: Fixed March 9, 2016 and will be live soon. The probleme here was with the internal cloud target collection that we receive from our server
* VideoDrawables: Fixed with 5.1.2. The probleme here was that the mediaserverd who is responsible for reading video frames was not managed properly.
* 'The issue that Axel pointed out': I tried to run the project provided by Axel but unfortunately it refers to target's that are not present in the .wtc which is loaded, so I couldn't have a look at the behaviour when targets are recognized. It the application just tries to find a target image, the memory only increases slightly (release build). I will investigate this, but it shouldn't be much of a problem (we're talking about kb here).
* 'starting/stopping our SDK': I noticed a slight leak when starting/stopping the same WTArchitectView multiple times. I investigate this further and add a fix to the next version.
* 'pause/resume': I'm not yet sure if this one is the same as the start/stop, but also here it might be that 3d model leak some memory. I also investigate into this one.

Hope this helps some of you.

Best regards

Andreas

Hi i installed yesterday the cordova plugin, not always, sometimes, and the memory increase in iphone each second (CPU 97% and memory 0 - 60%), during this my iphone 6 is disabled and when the memory reach at more than 60-70%  the app crash, my code:

 

  var World = {

    tracker: null,

    btn_scan: document.getElementById('scanButtonWrapper'),

    errorMessage: document.getElementById('errorMessage'),

 

    init: function initFn () {

      this.createTracker()

      //  this.createOverlays();

    },

 

    /*

      First an AR.CloudTracker needs to be created in order to start the recognition engine.

      It is initialized with your cloud identification token and the id of one of your target collections.

      Optional parameters are passed as object in the last argument. In this case callback functions for the onLoaded and onError triggers are set.

      Once the tracker is fully loaded the function worldLoaded() is called, should there be an error initializing the CloudTracker the

      function trackerError() is called instead.

    */

    createTracker: function createTrackerFn () {

      World.tracker = new window.AR.CloudTracker('xxxxxxx', 'xxxxxx', {

        onLoaded: function () {},

        onError: function (errorMessageTxt) {

          window.alert(errorMessageTxt)

        }

      })

    },

 

    /*

      The onRecognition callback function defines two parameters. The first parameter is a boolean value which indicates if the server was able

      to detect the target, it's value will be 0 or 1 depending on the outcome. The second parameter a JSON Object will contain metadata about

      the recognized target, if no target was recognized the JSON object will be empty.

    */

    onRecognition: function onRecognitionFn (recognized, response) {

      World.btn_scan.className = ''

      if (recognized) {

        console.log(recognized)

        console.log(response)

        console.log(response.metadata)

        window.AR.context.destroyAll()

        document.location = 'architectsdk://getData=' + JSON.stringify(response.metadata)

      } else {

        /*

          Image recognition failed. An error message will be displayed to the user.

        */

        World.errorMessage.className = ''

        //  window.alert('error code:')

      }

    },

 

    onRecognitionError: function onRecognitionError (errorCode, errorMessageTxt) {

      World.btn_scan.className = ''

      World.errorMessage.className = ''

    },

 

    /*

      In this function the recognition will be started, it is triggered by the onClick event of the scanButton.

    */

    scan: function scanFn () {

      /*

        The tracker recognize function is passed two callback functions. The first callback function will be called by the server after each

        recognition cycle. The second callback defines an on error callback function. It will be called if there is something wrong in

        your cloud archive.

      */

      World.btn_scan.className = 'clicked'

      World.errorMessage.className = 'hidden'

      World.tracker.recognize(this.onRecognition, this.onRecognitionError)

    },

 

    close: function closeFn () {

      window.AR.context.destroyAll()

      document.location = 'architectsdk://closeAR=true'

    }

  }

 

  World.init()

 

and when the another webview (ionic project) is enter i do:

 

$rootScope.wikitudePlugin.close(), so i close wikitude....

 

Thanks for all

 

 

 

 

 

Hi, are you using the latest version of our PhoneGap plugin? Could you also explain to me what you mean by 'my iphone is disabled'?

Best regards

Andreas

I have almost the same problem with Titnaium plugin.

Deleted AR.VideoDrawable doesn't release memory and cause memory reak warning.

Do you have a plan to release new Titanium version or some pre-release version?

I bought licence both iPhone/Android already.

I really appreciate if you give me some information.

 

 

 

Hi daichi,
We released a new verison of our SDK including all extensions just a few days ago. The Titanium version now contains all fixes mentioned earlier in this thread plus additional ones that we made specific for the release.

If you continue to encounter the issue you mentioned, can you please send us a Titanium demo project with which we can reproduce the issue? THX!

Best regards,

Andreas
Login or Signup to post a comment