Start a new topic

Memory Leak/Crash on iOS

Memory Leak/Crash on iOS

1 person has this problem


HI everybody. I tryed to destroy the object when the target exits the field of vision  and when it enters again, before creating the drawables again:

 

onExitFieldOfVision: (function (ii) {

return function(e) {

//trying to delete the objects and free the memory also here

var thisTrckbl = this;

var tgtAugmentsArray = tgtsArray.augments;

for(var j = 0; j < tgtAugmentsArray.length; j++){

thisTrckbl.drawables.removeCamDrawable(j);/**here I remove the cam drawable from the screen***/

World.emptyCamArrayImg = null;  /***here I try to clean the cam drawable object from the array***/

World.overlaysImg.destroy();  /******Trying to the drawable destroy here **********/

World.overlaysImg = null;  /*** here trying to clean the memory ***/

}

}

 


onEnterFieldOfVision: (function (ii) {

return function(e) {

$("#scanBar").hide();

//loop to try do clean the memory from the objects before creating the augmentations

for(var k = 0; k < World.emptyCamArrayImg.length; k++){

this.drawables.removeCamDrawable(k); /**here I remove the cam drawable from the screen***/

World.emptyCamArrayImg = null; /***here I try to clean the cam drawable object from the array***/

World.overlaysImg.destroy(); /******Trying to the drawable destroy here **********/

World.overlaysImg = null; /*** here trying to clean the memory ***/

}


 

Well if you asked me if the objects were really destroyed, I'm not sure because I'm afraid Idon't know how to debug and see if the objects are still there or not. Actualy I tryed your documentation that explains how to debug with safari and found it confusing an couldn't follow it. If you're saying there'se a method .destroyed(), please tell me how to use it because on what object do I call it on? the drawable? How can I know the drawable object name? 

Ok now for the crash report, I ran the app tethered to my computer using cordova cli "run ios --device --debug" command. I copied only the last lines here because I think are the ones that matter. Note there's no crash message, it gives off the warnings and the quit. I think it is good to say that before the warnings start the app stopped showing the images on screen. It would still recognize the target. I know that because when it does it hides the animated "scan bar" that is supposed to show when it has no target in sight. After some more target recognitions, it starts the warnings and then afer some more it quits 

 

 

2016-01-27 11:51:25.464 seeBeyond 6799.625993ms

2016-01-27 11:51:25.465 seeBeyond 6800.108016ms

2016-01-27 11:51:27.078 seeBeyond Resetting plugins due to page load.

2016-01-27 11:51:28.151 seeBeyond Finished load of: file:///var/mobile/Containers/Bundle/Application/A73215BC-A5FD-4927-9434-17F101770B8E/seeBeyond.app/www/index.html

2016-01-27 11:51:35.748 seeBeyond THREAD WARNING: took '167.119873' ms. Plugin should use a background thread.

2016-01-27 11:51:35.937 seeBeyond THREAD WARNING: took '187.864990' ms. Plugin should use a background thread.

2016-01-27 11:52:37.311 seeBeyond Received memory warning.

2016-01-27 11:52:37.393 seeBeyond Received memory warning.

2016-01-27 11:52:38.562 seeBeyond Received memory warning.

2016-01-27 11:52:38.983 seeBeyond Received memory warning.

2016-01-27 11:52:41.610 seeBeyond Received memory warning.

2016-01-27 11:52:41.658 seeBeyond Received memory warning.

2016-01-27 11:52:41.709 seeBeyond Received memory warning.

Hi I remembered that I think it is worth to say that the process restarts when you leave de AR screen, that is when you go back to the home page and forward to the AR screen again. It is like it resets the count and starts showing the augmentations again. If you do that before it crashes of course 

Update: I was testing again and this time it did gave out a crash message (the last line below):

 

2016-01-27 13:07:00.647 seeBeyond Received memory warning.

2016-01-27 13:07:03.543 seeBeyond Received memory warning.

2016-01-27 13:07:03.618 seeBeyond Received memory warning.

2016-01-27 13:07:09.856 seeBeyond Received memory warning.

Process 2762 exited with status = 0 (0x00000000) Terminated due to memory issue

Hi Axel,
THX for sharing the application log. The last one states that the application was terminated die to memory issues. My Idea was that you send me the crash report, but I can work with this information as well. Crash reports are always generated when the application was forced to quit and it also states which process used to much memory. You can find this file in the Xcode ->Window  -> Devices -> *Your Device* -> View Device Logs. A memory crash report looks slightly different than a e.g. null ptr crash report. It would be great if you could send that file as well, so that we see the process which consumed the memory.

You can also start your application directly with Xcode. To do so, open the platforms/ios/*.xcodeproj file.

Best regards

Andreas

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

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 Andreas,

Any luck reproducing the problem?

Thanks,

Jake

Hi Jake,
Over the last few weeks I was working on a new feature and will now continue working on reported issues. We will respond to you as soon as possible.

Best regards

Andreas

@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

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

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

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
Login or Signup to post a comment