Start a new topic

Memory Issues

Hi,


I have uploaded 4 object targets into a .wto using Wikitude Studio. When I include this into my app, the app crashes after approximately 5-10 seconds from what appears to be a memory issue.


This .wto is approximately 7mb in size. I was using a smaller .wto before and it would still crash, but would take a bit longer.


This is what I see in XCode leading up to and at the crash:


 

2019-03-31 19:39:09.545990-0500 Wikitude History App[330:10427] Metal API Validation Enabled
2019-03-31 19:39:11.064633-0500 Wikitude History App[330:10427] THREAD WARNING: ['WikitudePlugin'] took '1535.856934' ms. Plugin should use a background thread.
2019-03-31 19:39:12.228780-0500 Wikitude History App[330:10427] {"coords":{"latitude":32.83525534482586,"longitude":-97.07069497612588,"accuracy":65,"altitude":169.51536560058594,"heading":-1,"speed":-1,"altitudeAccuracy":10},"timestamp":1554079121747.218}
2019-03-31 19:39:16.414828-0500 Wikitude History App[330:10956] [Gyro] Manually set gyro-interrupt-calibration to 200
2019-03-31 19:39:23.608069-0500 Wikitude History App[330:10427] -- MEMORY WARNING --
2019-03-31 19:39:23.625633-0500 Wikitude History App[330:10427] Got memory pressure notification (non-critical)
2019-03-31 19:39:29.694216-0500 Wikitude History App[330:10427] Got memory pressure notification (critical)

 And then a couple more critical memory warnings before it crashes.


I am using an iPhone 5S to test the app.


Any advice on how to prevent this? Is there anything else I should provide in order to help diagnose why this occurs?




Yes, the JS and Cordova examples are working fine in how you have them set up.


I am going to try to set an app up with the AR as I have it but within your example app and see if it crashes at that point.


I am going to try this because the memory leak is specified as specifically coming from the WikitudeSDK as you can see in the photos. The project structure I use is a typical Angular 2+ application with the Cordova plugin. A user clicks on a link and the page it routes to initiates the AR based on the route.


I will let you know what I find.


Thanks.

Hi Eric,



I'm afraid I cannot provide support for Ionic as it's not one of our officially supported platforms. Any defects you would have to demonstrate in one of the official platforms. And, as far as I understood, the JS and Cordova example app are working fine. Correct me if I'm mistaken, please.


200MiB memory consumption seems about right for our SDK. Was this amount stable in the JS and Cordova examples?



- Daniel

Also is there anything else you can think of for me to do to help out if you feel this is something with Wikitude? If you don't believe it is Wikitude, do you know what it may be?

Hi,


Sorry for the delayed response. I was able to run the tests you suggested. Here's what I found.


Running both the sample JS app and Cordova app both proved to not crash the app. CPU usage was high and memory was getting up there, but not enough to crash the phone. Images are attached. Images of diagnostics are attached as SDKExamplesStats and CordovaExamplesStats.


Once I ran my app it crashed - the image titled ThreadCrash_0 is the thread that caused the memory crash from my understanding.


The app crashed once (and later again on my iPad) as a result of location services with Wikitude. I don't think this is related, but could it be? This is seen in ThreadCrash_Wikitude


I took an instrument trace that was showing thousands and thousands of memory leaks from various places. The largest ones (upwards of 68mb over less than a minute I believe) were in WikitudeSDK. Others were in Metal, MetalTools, UIKitCore, WebCore, WebKitLegacy, Foundation, JavaScriptCore, CoreMedia, and others. The trace file is 300mb so too large to send here. Would this help you to see the leaks that were specified as coming from WikitudeSDK? I attached photos titled WikitudeLeaks so you can see what I am mentioning.


I am using the latest version of Wikitude. I open the app with an Ionic v4 Cordova app. I use Vue.js to initiate and add DOM elements.


Running on my iPad Air 2 it first crashed with the same location error as shown in the iPhone picture (ThreadCrash_Wikitude) and then reopening I see the same WikitudeSDK leaks in instruments. It is able to handle the huge rise in memory without crashing but it gets up to about 1GB of memory being used when I enter the scene recognition world. I attached a picture of these leaks as iPadLeaks. Each one is about 300kb and there were 800+ in a minute and a half.


Is there anything you can think of that would help? Do you have any idea what could be causing these issues if not WikitudeSDK?


Thank you,

Eric

Hi Eric,



I wouldn't expect the age or state of your phone to make the difference, at least not if it runs fine otherwise. My current guess is an implementation difference between our sample app (which we test for releases) and your app, which is why I'd like you to try the sample app.


Here's a guide on how to set up our Cordova sample app. The easiest solution, however, would be not to use Cordova for your test, but the regular JavaScript SDK, which you can download here. It comes with a sample app that builds out of the box. Just open the contained Xcode project, build and run. The underlying code handling WTO files is the same for the JavaScript SDK and the Cordova plugin, so if you're having issues with Cordova, you should be having the same issues with the regular SDK.


I'd recommend just changing the basic object tracking sample (06_ObjectTracking_1_BasicObjectTracking) by simply replacing its WTO file with your own.



- Daniel

Ok. Thank you for trying it. It could be that my iPhone 5S is just on its last leg, do you agree?


I am using it in my own app using Ionic/Angular/Cordova which opens up the AR.


I will give it a shot here replacing the wto in the sample app.


Is this the sample app you are referring to? Which number/named world do you suggest I put it in for scene recognition of a .wto?


https://github.com/Wikitude/wikitude-cordova-plugin-samples

Hi Eric,



I can't seem to reproduce this issue on our iPhone 5s. Which iOS version is your's running?


Are you having this crash in your own app? Or did you change the Wikitude SDK sample app to user your WTO file? If the former happens to be the case, I'd like to try the latter and check whether it crashes for you as well.



- Daniel


Hi,


Thank you for the reply. I have attached the .wto to this comment. Let me know if there's anything else you may need?


I am not sure if it helps but most photos were taken using a Nikon D850.

wto
(2.37 MB)

Hi Eric,



would it be possible to have your WTO file to test with? That should be the quickest path to finding out what's going on. I don't see anything wrong with the code you posted.



- Daniel



1 person likes this

I just uploaded a new wto that was only 2.5mb in size and it still crashes. This is my code:


  

            let targetCollectionResource = new AR.TargetCollectionResource("assets/collections/tracker.wto", {
            });
            let tracker = new AR.ObjectTracker(targetCollectionResource, {
                onError: this.onError
            });
            console.log('3D Models');
            this.modelCar = new AR.Model("assets/models/car.wt3", {
                enabled: false,
                onLoaded: this.worldLoaded,
                onError: this.onError,
                scale: {
                    x: 1,
                    y: 1,
                    z: 1
                },
                onClick: function(){
                    world.modelClicked("CarModel");
                }
            });
            console.log('Trackable');
            let carObjectTrackable = new AR.ObjectTrackable(tracker, "*", { 
                drawables: {
                    cam: this.modelCar
                },
                onObjectRecognized: this.carObjectRecognized,
                onObjectLost: this.carObjectLost,
                onError: this.onError
            });
        },

  

Login or Signup to post a comment