Results 1 to 7 of 7

Thread: Store.destroy() doesn't remove store from stores's cache (Ext.StoreManager.map)

    Success! Looks like we've fixed this one. According to our records the fix was applied for TOUCH-2942 in a recent build.
  1. #1
    Sencha User
    Join Date
    Apr 2012
    Posts
    28
    Vote Rating
    3
      0  

    Default Store.destroy() doesn't remove store from stores's cache (Ext.StoreManager.map)

    REQUIRED INFORMATION
    Ext version tested:
    • Sencha 2.0.1
    Browser versions tested against:
    • Chrome 19.0
    Description:
    • When a store is created it is added to Ext.StoreManager.map by storeId as a key.
    • However store.destroy() doesn't remove it from the store's cache. So, the longer the application is used, the more memory is consumed as none of stores is actually released.
    • Calling Ext.StoreManager.unregister(store.getStoreId()) explicitly removes store reference from the cache. However I suppose that this should be done in destroy() method as even DataView relies on it when updating store to new (DataView.updateStore()) or am I missing anything?
    Steps to reproduce the problem:
    • Create a store
    • Check Ext.StoreManager.map -> store is added
    • Call store.destroy()
    • Check Ext.StoreManager.map -> store is still there, only isDestroyed flag is set to true
    Test Case:
    Code:
      Ext.define('User', {    extend: 'Ext.data.Model',
        config: {
            fields: [
                {name: 'firstName', type: 'string'},
                {name: 'lastName',  type: 'string'},
                {name: 'age',       type: 'int'},
                {name: 'eyeColor',  type: 'string'}
            ]
        }
    });
    
    
    var data = [
            {firstName: 'Ed',    lastName: 'Spencer'},
            {firstName: 'Tommy', lastName: 'Maintz'},
            {firstName: 'Aaron', lastName: 'Conran'},
            {firstName: 'Jamie', lastName: 'Avins'}
        ];
        
    var store1 = Ext.create('Ext.data.Store', {
        model: 'User', 
        storeId: 'test-store-1',
        data : data
    });
    
    
    Ext.StoreManager.map // 'test-store-1' is added to cache
    store1.destroy()
    Ext.StoreManager.map // 'test-store-1' is still in cache
    
    
    ////
        
    var store2 = Ext.create('Ext.data.Store', {
        model: 'User', 
        storeId: 'test-store-2',
        data : data
    });
    store2.autoDestroy = true;
    
    
    var touchTeam = Ext.create('Ext.DataView', {
        fullscreen: true,
        store: store2,
        itemTpl: '{name} is {age} years old'
    });
    
    
    Ext.StoreManager.map  // 'test-store-2' is in cache
    
    
    var store3 = Ext.create('Ext.data.Store', {
        model: 'User', 
        autoDestroy: true,
        storeId: 'test-store-3',
        data : data
    });
    
    
    touchTeam.setStore(store3)
    
    
    Ext.StoreManager.map // 'test-store-2' is still in cache though shouldn't, as expected to be destroyed
    Thank you in advance,

    Regards

  2. #2
    Sencha - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    39,336
    Vote Rating
    1297
      0  

    Default

    Thanks for the report.
    Mitchell Simoens @LikelyMitch
    Sencha Inc, Senior Software Engineer
    ________________
    Learn BBCode and use it!

    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 2012
    Posts
    28
    Vote Rating
    3
      0  

    Default

    Hi,

    Do you have any plans on when this issue will be fixed?

    Regards,

  4. #4
    Sencha User
    Join Date
    Mar 2007
    Location
    Haarlem, Netherlands
    Posts
    1,243
    Vote Rating
    11
      0  

    Default

    This has been fixed and will be part of the next release. Thanks for the report.

  5. #5
    Sencha User
    Join Date
    Mar 2012
    Posts
    8
    Vote Rating
    0
      0  

    Default

    Is there any hotfix or override for this bug?

    BTW, when 2.0.2 will be released? It is important to know 'cause we're in production and we can't still continue by searching for bugs and fixes of ST2 (we already update to ST2.0.1.1).

    Thanks,

    Matteo

  6. #6
    Sencha User
    Join Date
    Apr 2012
    Posts
    28
    Vote Rating
    3
      0  

    Default

    Hi,

    We're using the following override for now (it just calls 'unregister' method of StoreManager to release store on destroy):
    Code:
    Ext.define('MyApp.override.Store', {    
        override: 'Ext.data.Store',
    
         destroy: function () {
            this.callParent();
    
            Ext.StoreManager.unregister(this);
        }
    });
    Regards

  7. #7
    Sencha User
    Join Date
    Mar 2012
    Posts
    8
    Vote Rating
    0
      0  

    Default

    Thank's Natb, we will try it.

    Any news from Sencha team about 2.0.2?

    Quote Originally Posted by natb View Post
    Hi,

    We're using the following override for now (it just calls 'unregister' method of StoreManager to release store on destroy):
    Code:
    Ext.define('MyApp.override.Store', {    
        override: 'Ext.data.Store',
    
         destroy: function () {
            this.callParent();
    
            Ext.StoreManager.unregister(this);
        }
    });
    Regards

Posting Permissions

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