Results 1 to 9 of 9

Thread: columnwidget memory leak

    Thank you for reporting this bug. We will make it our priority to review this report.
  1. #1
    Sencha Premium Member ebett's Avatar
    Join Date
    Nov 2010
    Location
    Argentina
    Posts
    31

    Exclamation columnwidget memory leak

    Premises:
    - I have a grid with a columnwidget (form panel).
    -The form panel has fields bindigs to the record.
    -The store has memoryproxy.

    Steps to reproduce:
    - Add two records to the grid.
    - Clear the store (store.removeAll())
    At this point, the grid is empty. But, if I do
    Code:
     Ext.ComponentQuery.query('gridForm');
    I'm getting two forms .

    To fix this memory leak, I do:
    Code:
    grid.freeRowContexts.forEach(function(item){
        for( k in item.widgets){
            Ext.destroy(item.widgets[k]);
            delete item.widgets[k];
        }                
    });
    And that's all.
    Last edited by ebett; 5 Oct 2017 at 4:59 AM. Reason: correct premises

  2. #2
    Sencha Premium User evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    19,258

    Default

    Why do you say that's a memory leak? The grid architecture uses a pool of widgets that it keeps around. They get destroyed when the grid does.
    Twitter - @evantrimboli
    Former Sencha framework engineer, available for consulting.
    As of 2017-09-22 I am not employed by Sencha, all subsequent posts are my own and do not represent Sencha in any way.

  3. #3
    Sencha Premium Member ebett's Avatar
    Join Date
    Nov 2010
    Location
    Argentina
    Posts
    31

    Default

    If I do store.removeAll(); I'll expect Ext.ComponentQuery.query('gridForm'); to be empty. Because if I need to validate each record (form) , these records don't exists in the grid.

  4. #4
    Sencha Premium Member ebett's Avatar
    Join Date
    Nov 2010
    Location
    Argentina
    Posts
    31

    Default

    To be more clear. What I need to do is validate all forms in the grid.
    Code:
    validateGrid: function(){
    		var me = this,
    			vm = me.getViewModel(),
    			forms = Ext.ComponentQuery.query('gridForm'),
    			grid = me.lookupReference('gridQuestions'),
    			 i;
    
    
    		for(i = 0; i< forms.length; i++){
    			if(!forms[i].isValid()){
    				grid.ensureVisible(forms[i].getWidgetRecord());
    				return false;
    			}
    		}
    		return true;
    	},
    So, if the grid is empty, Ext.ComponentQuery.query('gridForm') mustn't get results!

  5. #5
    Sencha Premium Member Trevor4001's Avatar
    Join Date
    Sep 2013
    Posts
    113

    Default

    The widgets are stored outside of the grid when they are not in use. Try querying for forms in the grid.

    Code:
    var grid = this.lookupReference('gridQuestions');
    var forms = grid.query('gridForm');
    Trevor Karjanis

  6. #6
    Sencha Premium Member ebett's Avatar
    Join Date
    Nov 2010
    Location
    Argentina
    Posts
    31

    Default

    Ok, but why ExtJS persists old widgets in memory? It could be confuse if you use references or itemId and later search them. Wich instance I will get?

  7. #7
    Sencha Premium User evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    19,258

    Default

    The code that gets items via a query it supposed to only return live contexts, so if it's returning contexts for non-live items I guess that is a bug.

    But really you're asking the wrong question. Your interactions with the grid should be record based, not fishing about for components.
    Twitter - @evantrimboli
    Former Sencha framework engineer, available for consulting.
    As of 2017-09-22 I am not employed by Sencha, all subsequent posts are my own and do not represent Sencha in any way.

  8. #8
    Sencha Premium Member ebett's Avatar
    Join Date
    Nov 2010
    Location
    Argentina
    Posts
    31

    Default

    if we iterate the store records, Is there a way to obtain the widget ?, For example:
    Code:
    store.getRange().forEach(function(record){
        var gridForm = //How to obtain the widget here?  
        if(!gridForm.isValid()){
            return false; 
        }
    });

  9. #9
    Sencha Premium Member Trevor4001's Avatar
    Join Date
    Sep 2013
    Posts
    113

    Default

    With your approach the validation is on the forms (as opposed to the models), so you're inevitably searching for the forms.
    Code:
    var gridStore = gridPanel.getStore();
    var tableView = gridPanel.getView();
    var rowEl = Ext.get(tableView.getRow(gridStore.getAt(0)));
    var formPanel = rowEl.query('form')[0];
    However, Ext.data.Model has validation as well.
    Trevor Karjanis

Similar Threads

  1. IE8 Memory Leak?
    By Reimius in forum Ext: Discussion
    Replies: 1
    Last Post: 20 Jun 2012, 1:15 PM
  2. Memory leak?
    By darkhorni in forum Ext: 4.x Beta
    Replies: 1
    Last Post: 10 Feb 2012, 4:44 AM
  3. Replies: 0
    Last Post: 10 Oct 2008, 9:21 AM
  4. memory leak???
    By angbob in forum Ext 2.x: Help & Discussion
    Replies: 0
    Last Post: 22 May 2008, 12:39 AM
  5. Help with memory leak on FF.
    By Specks in forum Ext 2.x: Help & Discussion
    Replies: 3
    Last Post: 8 Oct 2007, 3:56 AM

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
  •