tags:

views:

26

answers:

0

Hi, I wonder if anyone has experienced memory leaks in IE7 when using dojos datagrids. I have used the dojo.addOnUnload to destroy the grid widget but it seems like there are still references to the grid and its subcomponents when i use the tool drip to analyze the memory leaks.

    <script type="text/javascript">

    dojo.require("dojox.grid.DataGrid");
    dojo.require("dojox.data.QueryReadStore");
    dojo.require("dijit._Widget");

    var gridLayout = null;
    var grid4 = null;
    var jsonStore = null;

    dojo.addOnLoad(function() {

    jsonStore = new dojox.data.QueryReadStore({
        url: "json",
        requestMethod:"post"

     });

 gridLayout = [
    new dojox.grid.cells.RowIndex({ name: "row #", width: 5, styles: "text-align: right;" }),
      {
       name: "Id",
       field: "id",
       styles: "text-align:right;",
       width:5
      },
      {
       name: "Name",
       field: "name",
       width:20

           }
     ];

        grid4 = new dojox.grid.DataGrid({
            query: {
                Name: '*'
            },
            store: jsonStore,
            rowsPerPage: 30,
            clientSort: true,
            rowSelector: '20px',
            structure: gridLayout
        },

        document.createElement('div'));

        dojo.byId("gridContainer4").appendChild(grid4.domNode);

        // Call startup, in order to render the grid:
        grid4.startup();

    });


    dojo.addOnUnload(function() {    

       var gridWidgetsList = grid4.getDescendants();
       dojo.forEach(gridWidgetsList, function(node, idx){
          alert(node);
       });

       grid4.destroyRecursive();       

       grid4 = null;
       gridLayout = null;
       jsonStore = null;

    });

</script>

<body>
<div id="gridContainer4" style="width: 600px; height: 200px;">
</div>
</body>

As you can see there is a destroyRecursive but there still seems to be references to the grid. Different td:s, tr:s and div:s that has been created by the DataGrid are left in memory. How do i nullify the other references to the same grid objects. After dojo.destroyRecursive has been run it seems that the DataGrid has been removed from the dom tree, since it dissappears in the browser.

Maybe it's just som simple misunderstanding from my point, might this have anything to do with closures? Would be thankful for a pointer in the right direction.