Forum

November 2nd, 2014
A A A
Avatar

Lost password?
Advanced Search

— Forum Scope —




— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

The forums are currently locked and only available for read only access
sp_Feed Topic RSS sp_Related Related Topics sp_TopicIcon
GridDestroy method does not clear all memory
25/01/2012
02:43
Avatar
lilibet
Member
Members
Forum Posts: 3
Member Since:
04/01/2011
sp_UserOfflineSmall Offline

Hi all,

I'm currently face a memory leak problem. When I simply create a grid then call 'GridDestroy' method to remove it, under IE there is around 1M memory cannot be released.

The following are the demo code:

<head>
  <script src="../../../javascripts/core/jquery-1.7.1.js" type="text/javascript"></script>
  <script src="../../../javascripts/core/table/jquery.jqGrid.src.js" type="text/javascript"></script>
  <script>
       var load = function() {
            var text = '<table id="jggrid-0"></table>';
            var contain = document.getElementById('container');
            contain.innerHTML = text;
            
            var tableData = [
                         {name:'ATT1',dataType:'STRING'}
                        ];
            var settings = {
                    datatype: "local",
                    colNames:['Name','Type'],
                    colModel:[
                              {name:'name',width:160},
                              {name:'dataType',width:110}
                              ],
                    keyColumn:'name',
                    data: tableData
            };
            $('#jggrid-0').jqGrid(settings);
       };
       var destroy = function(){
               $('#jggrid-0').jqGrid('GridDestroy');
               $('#container').find('table').remove();
               document.getElementById('container').innerHTML = "";
       };
  </script>
</head>
<body>
    <h1>table memory leak test</h1>
    <div>
        Iterations:
        <span id="repeats"></span>
    </div>
    <button id="button1" onclick='load()'>Load</button>
    <button id="button2" onclick='destroy()'>Destroy</button>
    <div id="container">
    </div>
    <div id="GC" class="hidden"></div>
</body>

When first time load the page then click 'load' button, the memory increased around 5M. Click on 'destroy' button after, around 4M memory released, but 1M remain. If keep click 'load'/'destroy' again and again, then each load taken extra 200Kb memory. All the test has been done under IE8.

I tried all different versions of the jqgrid from 4.1.1 to 4.3.1, the result are same. And if push more data in table or add more columns the leaks becomes bigger.

Is anyone get the same problem and have any solution for it? Thanks.

08/02/2012
01:36
Avatar
zebra
Member
Members
Forum Posts: 4
Member Since:
08/02/2012
sp_UserOfflineSmall Offline

I also interested in solution of this problem. I have tested leak on following example:

var count = 0, timeout, elem, id = 0;
(function() {
    if(id) {
        $('#' + id).jqGrid('GridDestroy');
        $('#' + id).remove();
    }
    console.log(count++);
    id = 'i' + count;
    $('body').append('<table id="' + id + '"></table>');

    $('#' + id).jqGrid({ datatype: "local", height: 250, colNames:['Inv No'], colModel:[ {name:'id',index:'id', width:60, sorttype:"int"} ]});
    
    timeout = setTimeout(arguments.callee, 300);
}());

08/02/2012
15:58
Avatar
zebra
Member
Members
Forum Posts: 4
Member Since:
08/02/2012
sp_UserOfflineSmall Offline

Replaced all event mouseup / mousemove a document on "gbox_" + grid_id and commented out events window.onload and leaks disappeared. Try my code. download

16/02/2012
07:23
Avatar
lilibet
Member
Members
Forum Posts: 3
Member Since:
04/01/2011
sp_UserOfflineSmall Offline

Hi zebra,

I've tried to replace all event and commented out window.onload, and also tried replace the file by your code. But nothing was working for me, the memory still leaking.

I'm keep looking for the solutions.

Thanks

29/02/2012
17:40
Avatar
zebra
Member
Members
Forum Posts: 4
Member Since:
08/02/2012
sp_UserOfflineSmall Offline

try this

01/03/2012
13:10
Avatar
tony
Sofia, Bulgaria
Moderator
Members

Moderators
Forum Posts: 7721
Member Since:
30/10/2007
sp_UserOfflineSmall Offline

Hello,

Can some one give me a link to this so commented issue?

Thank you.

Kind Regards

For professional UI suites for Java Script and PHP visit us at our commercial products site - guriddo.net - by the very same guys that created jqGrid.

02/03/2012
04:48
Avatar
lilibet
Member
Members
Forum Posts: 3
Member Since:
04/01/2011
sp_UserOfflineSmall Offline

Hi Zebra,

Thank you very much! I tested the latest code you supplied. There is no leak anymore once I destroy the table.

But now by using your code, I find another issue. Once I called the "delRowData" method, I got the following error:

a(E, d).closest("table.ui-jqgrid-btable")[0] is undefined

Could you please help me find what's wrong with it?

Thanks again.

02/03/2012
08:33
Avatar
zebra
Member
Members
Forum Posts: 4
Member Since:
08/02/2012
sp_UserOfflineSmall Offline

I dont have trouble with delRowData command. Check function arguments.

Forum Timezone: Europe/Sofia

Most Users Ever Online: 715

Currently Online:
18 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

OlegK: 1255

markw65: 179

kobruleht: 144

phicarre: 132

YamilBracho: 124

Renso: 118

Member Stats:

Guest Posters: 447

Members: 11373

Moderators: 2

Admins: 1

Forum Stats:

Groups: 1

Forums: 8

Topics: 10592

Posts: 31289

Newest Members:

, razia, Prankie, psky, praveen neelam, greg.valainis@pa-tech.com

Moderators: tony: 7721, Rumen[Trirand]: 81

Administrators: admin: 66

Comments are closed.
Privacy Policy   Terms and Conditions   Contact Information