Forum
12:20
28/02/2012
Hello,
The example jqGrid code used is attached below.
Some observations – the jqGrid 4.3.1 leaks memory when this simple case is run. The test case run on the code is to load the grid with data (around 500 records) unload the data using clearGridData() and reloading the grid with data and repeating this for around 100 times. No table creation just plain simple loading and unloading of data from the jqGrid.
Instead of using the 4.3.1 version of jqGrid we use the 4.1.2 version of jgGrid you willl not notice any memory leak. Click 'create' then 'start' to observe the memory leaks in task manager.
This is observed only on IE8. On running this for a long time this was the graph that was obtained as far as memory usage of the iexplore process goes. You can see that 4.1.2 stays within the band – but 4.3.1 memory usage is climbing with time.
Is there anything that I am doing that is wrong (api usage etc. with 4.3.1)
Please help.
——
<!DOCTYPE html>
<html>
<head>
<title>jqGrid Example</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1″ />
<link type="text/css" href="themes/overcast/jquery-ui-1.8.15.custom.css" rel="stylesheet" />
<style type="text/css">
.oddRow {
background: none;
background-color: antiquewhite;
}
</style>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="jquery-ui-1.8.15.custom.min.js"></script>
<link type="text/css" href="css/ui.jqgrid.css" rel="stylesheet" />
<script type="text/javascript" src="js/i18n/grid.locale-en.js"></script>
<script type="text/javascript" src="jquery.jqGrid.js"></script>
<script type="text/javascript">
var rowCount = 500, dataGrid;
var interval = 5, running = false;
var data = [];
$(function(){
$('#lnk_create').click(doCreate);
$('#lnk_load').click(doLoading);
$('#lnk_start').click(doStart);
$('#lnk_stop').click(doStop);
$('#lnk_remove').click(doUnload);
});
function invoke()
{
if(!running)
{
return;
}
$('#lnk_load').click();
setTimeout(invoke, 1000 * this.interval);
}
function getList()
{
var list = [];
for(var index = 1; index < rowCount; index++)
{
list.push({
id: index,
invdate: '2007-10-' + index,
name: 'test' + index,
note: 'note' + index,
amount: '200.00',
tax: '10.00',
total: '210.00'
});
}
return list;
}
function doLoading()
{
data = getList();
dataGrid.clearGridData();
for(var index = 1; index < data.length; index++)
{
dataGrid.addRowData(index, data[index]);
}
dataGrid.trigger(‘reloadGrid’);
}
function doUnload(ev)
{
ev.preventDefault();
dataGrid.GridUnload();
delete dataGrid;
}
function doStop(ev)
{
ev.preventDefault();
running = false;
}
function doStart(ev)
{
ev.preventDefault();
if(running)
{
return;
}
running = true;
invoke();
}
function doCreate(ev)
{
ev.preventDefault();
dataGrid = $("#list", $('#main')).jqGrid({
datatype: "local",
colNames:['Inv No','Date', 'Client', 'Amount','Tax','Total','Notes'],
colModel:[
{
name:'id',
index:'id',
width:60,
sorttype:"int"
},
{
name:'invdate',
index:'invdate',
width:90,
sorttype:"date"
},
{
name:'name',
index:'name',
width:100
},
{
name:'amount',
index:'amount',
width:80,
align:"right",
sorttype:"float"
},
{
name:'tax',
index:'tax',
width:80,
align:"right",
sorttype:"float"
},
{
name:'total',
index:'total',
width:80,
align:"right",
sorttype:"float"
},
{
name:'note',
index:'note',
width:150,
sortable:false,
search: false
}
],
deepempty: true,
altRows: true,
altclass: 'oddRow',
rowNum: 10,
rowList:[10,20,30],
multiselect: true,
pager: '#pg',
viewrecords: true,
height: 300,
width: 600,
autowidth: true,
recordtext: "Rec {0} – {1} of {2}",
caption: "Invoice Data………"
});
$("#list", $('#main')).jqGrid('navGrid','#pg', {
edit:false,
add:false,
del:false
});
}
</script>
</head>
<body>
<h2>jqGrid Example2 with Auto-Refresh</h2>
<div id="main">
<div id="toolbar">
<a href="#create" id="lnk_create">create</a>
||
<a href="#start" id="lnk_load">load</a>
||
<a href="#start" id="lnk_start">start</a>
||
<a href="#stop" id="lnk_stop">stop</a>
||
<a href="#remove" id="lnk_remove">remove</a>
</div>
<table id="list"></table>
<div id="pg"></div>
</div>
</body>
</html>
13:02
Moderators
30/10/2007
Hello,
Which version of jQuery is used?
Can you please try with the last one.
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.
15:48
28/02/2012
@All visiting this thread
- Please take a look at this thread - http://www.trirand.com/blog/?p.....ory-leaks/
Most Users Ever Online: 715
Currently Online:
46 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