Forum
02:43
04/01/2011
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.
01:36
08/02/2012
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);
}());
15:58
08/02/2012
Replaced all event mouseup / mousemove a document on "gbox_" + grid_id and commented out events window.onload and leaks disappeared. Try my code. download
13:10
Moderators
30/10/2007
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.
04:48
04/01/2011
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.
Most Users Ever Online: 715
Currently Online:
48 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.comModerators: tony: 7721, Rumen[Trirand]: 81
Administrators: admin: 66