1. #1
    Sencha User
    Join Date
    Mar 2013
    Posts
    4
    Vote Rating
    0
    jdockins is on a distinguished road

      0  

    Default Touch 2.1 Store Load Memory Leak?

    Touch 2.1 Store Load Memory Leak?


    I am having a problem with loading a store and leaking memory. I have a store that I need to load every 5 seconds. I am using DelayedTask to perform the polling. The store pulls back a fairly large JSON dataset and after a couple hours has hit 500MB. I perform the polling in a controller.
    I have stripped out all logic down to just loading the store. Regardless if I use DelayedTask or setInterval, the leak is the same. I've tracked it down to the store.load logic. Atleast I think I have.
    I also removed the callback from store load and performed the task.delay in the load event listener. The leak still persists.

    I also used Ext.Ajax to pull the data every 5 seconds. The memory leak is still there, but it is a little smaller.

    So, I do not know if I am doing this wrong and introducing closures or is this a bug?

    Any help appreciated!

    Model
    Code:
    Ext.define('fimobile.model.myModel', {    extend: 'Ext.data.Model',
    
    
        config: {
            fields: [
                {name: 'a', type: 'string'},
                {name: 'b', type: 'string'},
                {name: 'c', type: 'string'},
                {name: 'd', type: 'string'},
                {name: 'e', type: 'string'},
                {name: 'f', type: 'string'},
                {name: 'g', type: 'string'},
                {name: 'h', type: 'string'},
                {name: 'i', type: 'string'},
                {name: 'j', type: 'string'}
            ]
        }
    
    });


    Store
    Code:
    Ext.define('fimobile.store.myStore', {    extend: 'Ext.data.Store',
        config: {
            storeId: 'myStoreID',
                model: 'app.model.myModel',
            proxy: {
            type: 'ajax',
            url : url,
            reader: {
                type: 'json',
                rootProperty: 'data',
                successProperty: 'success'
            }
            },  
            autoLoad: true
        }
    });


    Controller
    Code:
    Ext.define('fimobile.controller.myController', {    extend: 'Ext.app.Controller',
    
    
        config: {
            views: ['myView'],
            models: ['myModel'],
            stores: ['myStore'],
            refs: {  
            },
            control: { 
                'myView': {
                    initialize: this.start
                }
            }
        },
    
    
        start: function () {        
            task = Ext.create('Ext.util.DelayedTask', function() {      
                this.getData();
            }, this);
            task.delay(5000);
        },
    
    
        getData: function() {               
            Ext.getStore('myStore').load({
                scope: this,
                callback : function(records, operation, success) {
                    console.log('callback');
                    task.delay(5000);
                }
            });
         }
    });
    Last edited by jdockins; 27 Mar 2013 at 6:07 PM. Reason: formatting

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    36,756
    Vote Rating
    828
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    Is the task variable global now? Looks like it which can lead to memory leaks itself but I don't think that is the cause of what you are seeing.

    It's definitely possible that there is a reference somewhere that is left and not cleaned up. I personally have not seen any store leaks but I also don't refresh my stores every 5 seconds.
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  3. #3
    Sencha User
    Join Date
    Apr 2011
    Posts
    134
    Vote Rating
    1
    stefankendall is an unknown quantity at this point

      0  

    Default


    I have an automated test suite which crashes if I do too much store manipulation. I had to break my test suite into multiple files to overcome the memory leak.

  4. #4
    Sencha Premium Member
    Join Date
    May 2011
    Posts
    71
    Vote Rating
    6
    cyee is on a distinguished road

      0  

    Default


    It might be related to an Ajax.request leak

    http://www.sencha.com/forum/showthre...leaking-memory

  5. #5
    Sencha User
    Join Date
    Mar 2013
    Posts
    4
    Vote Rating
    0
    jdockins is on a distinguished road

      0  

    Default Switched to Ext.Ajax

    Switched to Ext.Ajax


    Thanks for the feedback. My initial work was on Touch 2.0 and I have since upgraded to 2.1.1.

    I implemented Ext.Ajax to handle the request. The leak disappears. At first, I thought I had to destroy the reference to the Ext.Ajax call and rebuild it each time. But since, I do not even need to do that.

    I placed the task in a global variable and on the controller. It did not have an effect either way.

    Once I get this version out, I will go back and revisit the store.load issue to see if still remains on 2.1.1. I'd really like to use a store so I can leverage the same data in a grid, etc.

    Thanks again!

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..." hd porno faketaxi