Memory Leaks In Titanium apps

Solution

1.Remove all the remove all not necessary event listener.

2.Remove all the SetInterval Function.

Method for using Geolocation location Event Listener

function LocationClass(parent)  
{
    this.Parent = parent;
    var thisClass = this;

    //Geolocation Setup
    Ti.Geolocation.accuracy = Ti.Geolocation.ACCURACY_HIGH;
    Ti.Geolocation.distanceFilter = 10;
    Ti.Geolocation.preferredProvider = Ti.Geolocation.PROVIDER_GPS;

    var locationCallback = function(e){            
       if(!e.success || e.error){
           Ti.API.info("error"+JSON.stringify(e.error));
       } else{      
            Ti.API.info("Show the Geolocation Time: " + e.coords.timestamp);
       }
   };

    this.onStartButton_Click = function()
    {
        var thisClass = this;
        Ti.API.log("EventListener_Start");
        Ti.Geolocation.addEventListener('location', locationCallback);
    };

    this.onStopButton_Click = function()
    {
        var thisClass = this;
        Ti.API.log("EventListener_Stop");
        Ti.Geolocation.removeEventListener('location', locationCallback);
    }; 
};

Refer URL:

https://wiki.appcelerator.org/display/guides2/Managing+Memory+and+Finding+Leaks