Success! Looks like we've fixed this one. According to our records the fix was applied for EXTJS-9181 in 4.2.1.744.
  1. #1
    Sencha User
    Join Date
    Mar 2013
    Location
    Switzerland
    Posts
    1
    Vote Rating
    0
    gtroxler is on a distinguished road

      0  

    Default Possible memory leak caused by animations

    Possible memory leak caused by animations


    I experienced problems with a continuously increasing memory footprint when I implemented the following functionality:

    • In regular interval, a table must be updated with data loaded from a server.
    • The changed cells in the table should be visualized using the highlight animation.

    I implemented this using a grid and a memory store which I reloaded in the background. Once the store was reloaded I refreshed the view and started animations on the changed cells.

    I think that the DOM-nodes representing the grid are created every time the view is refreshed. First I used Ext.fly to highlight the cells. This led to an always increasing memory size and DOM-node count since the GC could not collect the global cached DOM-nodes and some memory associated with it. I then changed to Ext.get which led to a constant memory footprint over time.

    Still the DOM-node count increased and led to a browser crash. I profiled the usage and found that Ext.fx.manager caches the target DOM-nodes in a global cache (targets). The approach to solve this issue was to remove an animation from the fx queue once the animation terminated. If the queue is empty at that point we also remove the animation target from the global cache which will allow the GC to collect the possibly orphaned DOM-nodes. Below you can see the diff of my change that did the trick. I am not sure if the change has any undesired side effects.

    Is there a way to force extjs to clear global caches without reloading?

    Code:
    diff --git a/ext-4.1.1a/ext-all-debug-w-comments.js b/ext-4.1.1a/ext-all-debug-w-comments.js
    index 741cfd7..6d1f8c0 100755
    --- a/ext-4.1.1a/ext-all-debug-w-comments.js
    +++ b/ext-4.1.1a/ext-all-debug-w-comments.js
    @@ -63764,7 +63764,18 @@ Ext.define('Ext.fx.Manager', {
           var me = this,
           items = me.items,
           task = me.task;
    -                
    +    var  target = anim.target;
    +    var queue = me.getFxQueue(target.getId());
    +        
    +    if(queue[0] == anim){
    +        queue.pop();
    +        if(queue.length == 0){
    +            me.targets.remove(target);
    +        }
    +    }
    +
    +
    + 
             items.removeAtKey(anim.id);
             //Ext.log('    X removed anim ', anim.id, ', target: ', anim.target.getId(), ', frames: ', anim.frameCount, ', item count: ', items.length);

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


    Thanks for the report! I have opened a bug in our bug tracker.

Thread Participants: 1

Tags for this Thread