Start a new topic

Reloading the AR view data

Reloading the AR view data

1 person has this problem

I have got a functionality whereby we need to switch between two sets of objects. And all of them have got an image. I am clearing the loaded objects using AR.context.destroyAll() and reloading the new ones. But this is taking up lot of memory. Is there anything else to be done to clear up the data. I tried the clearCache method but that didn't solve the problem. Need an urgent response. Thanks.


I'm not sure what you mean by taking up a lot of memory? Are you refering to main memory or disk space?

Basically everything stored in main memory should be gone if you call destoryAll(). An exception to this are resources which will if not locally available be cached and might consume some main memory and additional disk space.

We recommend that images are create only when needed, e.g. only load the ones you are actually going to display to the user. Depending on your current design/approach this could be something to consider. To give you additional advice please describe your use case and the current limitations in more details.

The requirement is to load about 50 objects in the AR view. Each one has an image. I am downloading the images before hand and storing in the device. Then the path of the image is passed to the objects and the image is loaded up using AR.ImageResource(path). This is all fine but then I have got a toggle option wherein the set of objects have to be toggled. I have to remove these objects and load another set of similar objects. This toggling is where the app experiences a lot of lag and then memory warning comes up and then the whole thing crashes after a few toggles.

destroyAll() should provide you the necessary clean start for the different set of objects. I would use the ADE to verify that there is not a problem in the logic and objects are created unecessary. If that is not the issue, I would appreciate if you can post or send us (info AT wiktiude DOT com) an example that allows us to reproduce the problem and fix it quickly.



Below is the code to load data from the js file. I just pass nil parameter to clear the architect view using the line: ;

loadPoisFromJsonData: function loadPoisFromJsonDataFn(poiData) {

        if (!poiData) {




    // show radar;

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

        var singlePoi = {


            "type": poiData.type,

            "latitude": parseFloat(poiData.latitude),

            "longitude": parseFloat(poiData.longitude),

            "altitude": parseFloat(poiData.altitude),


            "description": "",

            "imageUrl": poiData.imageUrl,

            "imagePath": poiData.imagePath


        World.markerList.push(new Marker(singlePoi));




this is an extract from marker.js file, path of locally saved images is passed on to this:

var markerLocation = new AR.GeoLocation(poiData.latitude, poiData.longitude, poiData.altitude);

    var img = new AR.ImageResource(poiData.imagePath);

    this.markerDrawable_idle = new AR.ImageDrawable(img, 2.5, {

                                                    zOrder: 0,

                                                    opacity: 1.0,

                                                    onClick: Marker.prototype.getOnClickTrigger(this)


        this.markerDrawable_selected = new AR.ImageDrawable(img, 2.5, {

                                                        zOrder: 0,

                                                        opacity: 0.0,

                                                        onClick: null





are you using about 50 different images or do you use only about 2 or 3 images for all of your pois? If you only need 2 or 3, then you don't have to create 50 AR.ImageResources but instead only 2 or 3 and reuse them for all the other AR.ImageDrawables.

Best regards


50 different images. All the objects have unique images.

How big are the images? We suggest not going bigger than 256x256 for smaller images like POI icons.
Login or Signup to post a comment