1. #1
    Ext JS Premium Member
    Join Date
    Oct 2010
    Posts
    81
    Vote Rating
    1
    rhamflett is on a distinguished road

      0  

    Default Cleaning up transaction history

    Cleaning up transaction history


    I've noticed that Ext.Direct.transactions contains a history of Ext.Direct calls. In the case of the call that I'm using to load a form, this information includes a reference to that form instance. The result is that the memory for the form is never released. Is there a way to clear this history (or specific entries) and properly free up the memory?


    Thanks,
    Rob

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,654
    Vote Rating
    903
    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 there a reason to keep a history?
    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
    Ext JS Premium Member
    Join Date
    Oct 2010
    Posts
    81
    Vote Rating
    1
    rhamflett is on a distinguished road

      0  

    Default


    Quote Originally Posted by mitchellsimoens View Post
    Is there a reason to keep a history?
    No, so how do I stop the framework from doing it?

  4. #4
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,654
    Vote Rating
    903
    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


    Quote Originally Posted by rhamflett View Post
    No, so how do I stop the framework from doing it?
    What provider are you using? Looks like the RemotingProvider removes the transaction on success or failure. I don't see where JsonProvider or PollingProvider does this.
    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.

  5. #5
    Ext JS Premium Member
    Join Date
    Oct 2010
    Posts
    81
    Vote Rating
    1
    rhamflett is on a distinguished road

      0  

    Default


    My Ext Direct calls are defined like this:

    Code:
    Ext.app.EXTDIRECT_API = {
      "url" : "\/direct\/router",
      "type" : "remoting",
      "actions" : 
      {
        "dbs" : 
        [
          {
            "name" : "getAgents",
            "len" : 1,
            "args" : 
            [
            ]
          },
          {
            "name" : "setRating",
            "len" : 1,
            "args" : 
            [
            ]
          },
          {
            "name" : "calculateRating",
            "len" : 0,
            "args" : 
            [
            ]
          },
          {
            "name" : "getCpus",
            "len" : 1,
            "args" : 
            [
            ]
          },
          {
            "name" : "setSettings",
            "len" : 1,
            "formHandler" : true,
            "args" : 
            [
            ]
          },
          {
            "name" : "getSettings",
            "len" : 0,
            "args" : 
            [
            ]
          }
        ]
      }
    };
    Any time I call one of those functions a new item is added to the Ext.Direct.transactions.items array.

  6. #6
    Ext JS Premium Member
    Join Date
    Oct 2010
    Posts
    81
    Vote Rating
    1
    rhamflett is on a distinguished road

      0  

    Default


    Just realised I never mentioned what version I'm on. This is using the new 4.0.7.

  7. #7
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,654
    Vote Rating
    903
    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


    If you look at RemotingProvicer.js source, on like 298 and 318 it executes the removeTransaction method on the Ext.direct.Manager. Set a breakpoint and see if that ever gets to it. I wouldn't set a breakpoint at those lines, I would do at the beginning of the method and follow it. It's the onData method in RemotingProvider
    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.

  8. #8
    Ext JS Premium Member
    Join Date
    Oct 2010
    Posts
    81
    Vote Rating
    1
    rhamflett is on a distinguished road

      0  

    Default


    The onData() method of RemotingProvider calls Ext.direct.Manager.removeTransaction() on line 298. This in turn calls getTransaction(), which checks for an isTransaction property on the transaction object. Since there isn't one it performs another look-up which fails and returns undefined. If I call Ext.direct.Manager.removeTransaction() using the original value for the transaction object that's passed into removeTransaction then the item appears to be removed as expected.


    Where should the isTransaction property come from? It appears to be the condition that causes the failing lookup. I had a look in ext-all-debug-w-comments.js and 'isTransaction' only appears that one time where it's read. I did a search in the API docs for 'isTransaction' and came up empty.

  9. #9
    Ext JS Premium Member
    Join Date
    Oct 2010
    Posts
    81
    Vote Rating
    1
    rhamflett is on a distinguished road

      0  

    Default


    Hi,

    Is there any more information you can provide?

    Thanks,
    Rob

  10. #10
    Ext JS Premium Member
    Join Date
    Feb 2008
    Posts
    14
    Vote Rating
    0
    plinyar is on a distinguished road

      0  

    Default A hotfix

    A hotfix


    This fix worked for me:

    Code:
    Ext.direct.Manager.getTransaction = function(transaction){
        return transaction.isTransaction || Ext.isObject(transaction) ? 
            transaction : 
            this.transactions.get(transaction);
    };

Thread Participants: 2