Forum



18:47

14/11/2012

I'm testing with a simple example that create a grid when the page is loaded.
The HTML code:
<button id="createGridBtn">Create grid</button>
<div id="grids">
</div>
The JS code:
var createGrid = function () {
$grid = jQuery('<table id="grid"></table>');
$grid.appendTo(jQuery('#grids'));
$grid.jqGrid({
data: [],
datatype: 'local',
width: 700,
height: 'auto',
colNames: [
'Id',
'Type',
'Description',
'Notes',
'Main'
],
colModel: [
{
name: 'contactDataId',
index: 'contactDataId',
width: 0,
sorttype: "int",
hidden: true
},
{
name: 'typeName',
index: 'typeName',
width: 4
},
{
name: 'description',
index: 'description',
width: 5
},
{
name: 'notes',
index: 'notes',
width: 2
},
{
name: 'isMain',
index: 'isMain',
width: 2,
align: "center"
}
],
multiselect: true,
caption: 'Contact data'
});
};
var _destroyAndCreateGridHandler = function (event) {
jQuery('#grid').jqGrid('GridDestroy');
createGrid();
};
$(document).ready(function() {
createGrid();
jQuery('#createGridBtn').on('click', _destroyAndCreateGridHandler);
});
Then, when I click in the button, the old grid is destroyed and creates a new grid.
I have been analyzing this test with the "Take Head Snapshot Profile" of Google Chrome:
- Loaded page: 3.20MB
- Perform click on the button: 3.28MB
- Another click: 3.35MB
- ...
As I could see, the memory grows when I destroy the old grid and create the new.
My question is, why? The memory should be the same, because I'm destroying the old grid and create the new.
Please, can anyone help me?
Most Users Ever Online: 715
Currently Online:
39 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