Results 1 to 5 of 5

Thread: Touch 2.1 Store Load Memory Leak?

  1. #1
    Sencha Premium User
    Join Date
    Mar 2013
    Posts
    6

    Default 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 Premium User mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    40,392

    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 @LikelyMitch
    Modus Create, Senior Frontend Engineer
    ________________
    Need any sort of Ext JS help? Modus Create is here to help!

    Check out my GitHub:
    https://github.com/mitchellsimoens

  3. #3

    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

    Default

    It might be related to an Ajax.request leak

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

  5. #5
    Sencha Premium User
    Join Date
    Mar 2013
    Posts
    6

    Default 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!

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •