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
GridUnload memory leak?
23/06/2010
18:11
Avatar
luweipan
Member
Members
Forum Posts: 6
Member Since:
23/06/2010
sp_UserOfflineSmall Offline

Create and unload grid again and again. The browser memory grow rapidly。The browser version is 5.0.375.70

while(true) {

$("#gridTable").jqGrid({

height: 250,

width: 400,

colNames:['id','name'],

colModel:[

{name:'id'},

{name:'name'}

],

rowNum:10,

});

$("#gridTable").GridUnload();

}

23/06/2010
18:45
Avatar
Les
Member
Members
Forum Posts: 44
Member Since:
11/12/2009
sp_UserOfflineSmall Offline

This is not a good test because the garbage collector has no chance to kick in.

Try setInterval(function() { }, 200) instead of while.

I don't see any memory increase after 100 invocations.

24/06/2010
09:57
Avatar
luweipan
Member
Members
Forum Posts: 6
Member Since:
23/06/2010
sp_UserOfflineSmall Offline

    I try setInterval(function() { }, 200). And still has memory leak. Chrome occupy 38M memory at the begin. Chrome occupy 600M memory after run this test case for one hour.

    IE 8 and Firefox 3.5.5 have the same problem.

    The jqGrid version is 3.7.1. The operating system is Windows XP.


<html>

<head>

<script type='text/javascript' src='jquery.jqGrid/js/jquery-1.4.2.min.js'></script>

<link rel="stylesheet" href="jquery/css/smoothness/jquery.ui.all.css" type="text/css" media="screen">

<link rel="stylesheet" href="jquery.jqGrid/css/ui.jqgrid.css" type="text/css" media="screen">

<script type="text/javascript" src="jquery.jqGrid/js/i18n/grid.locale-en.js"></script>

<script type="text/javascript" src="jquery.jqGrid/src/grid.base.js"></script>

<script type="text/javascript" src="jquery.jqGrid/src/grid.common.js"></script>

<script type="text/javascript" src="jquery.jqGrid/src/grid.custom.js"></script>

<script type="text/javascript" src="jquery.jqGrid/src/grid.formedit.js"></script>

<script type="text/javascript" src="jquery.jqGrid/src/grid.inlinedit.js"></script>

<SCRIPT LANGUAGE="JavaScript">

$(document).ready(function(){

setInterval(function() {

$("#table").jqGrid({

datatype:function() {},

height: 250,

width: 300,

colNames:['id', 'name', 'phone'],

colModel:[

{name:'id'},

{name:'name'},

{name:'phone'}

],

rowNum:10

});

$("#table").GridUnload();

}, 200);

});

</SCRIPT>

</head>

<body>

<table id='table' />

</body>

</html>

24/06/2010
13:33
Avatar
tony
Sofia, Bulgaria
Moderator
Members

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

Hello,

1. I see datatype as function in your code. This means that you made your own ajax request. Until this request comme to the grid they is already destroyed. That is: the request (data) is in your memory not knowing where to go.

The real test is:

Sorry edit:

In the succes (or complete) event in your ajax request call the GridUnload after a delay.

Regards

Tony

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.

25/06/2010
13:45
Avatar
luweipan
Member
Members
Forum Posts: 6
Member Since:
23/06/2010
sp_UserOfflineSmall Offline

    My datatype function is empty. No ajax request. The example I provided is the whole test case. You can paste in a file and run the testcase.

    Though I GridUnload right after creating the grid, It should not has any memory leak. I think something not release in GridUnload.

25/06/2010
14:11
Avatar
luweipan
Member
Members
Forum Posts: 6
Member Since:
23/06/2010
sp_UserOfflineSmall Offline

I got it. These codes in the grid.base.js cause memory leak:

$(document).mouseup(function (e) {

if(grid.resizing) { grid.dragEnd(); return false;}

return true;

});

...

$(window).unload(function () {

ts = null;

});

 These codes bind events when creating each grid. And never free.

25/06/2010
15:50
Avatar
tony
Sofia, Bulgaria
Moderator
Members

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

Hello,

Thanks for the investigation.

If you replace

$(document).mouseup(function (e) {

if(grid.resizing) { grid.dragEnd(); return false;}

return true;

})

with

$(grid.hDiv).mouseup(function (e) {

if(grid.resizing) { grid.dragEnd(); return false;}

return true;

})

Does this happen?

Best Regards

Tony

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.

25/06/2010
19:10
Avatar
luweipan
Member
Members
Forum Posts: 6
Member Since:
23/06/2010
sp_UserOfflineSmall Offline

    It still has memory leak if change "$(document).mouseup" to "$(grid.hDiv).mouseup".  If I comment the following lines. No more memory leak.

/*$(window).unload(function () {

ts = null;

});*/

28/06/2010
11:53
Avatar
tony
Sofia, Bulgaria
Moderator
Members

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

Hello,

Thanks for investigation.

Also windows unload is raised if a refresh button by exmple is clicked, that is this is not seen in your code.

Little confused about this

Regards

Tony

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.

Forum Timezone: Europe/Sofia

Most Users Ever Online: 715

Currently Online:
50 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