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
jqGrid version 4.3.1 - leaks memory in simple use cases - please help
29/02/2012
12:20
Avatar
caradees
Member
Members
Forum Posts: 8
Member Since:
28/02/2012
sp_UserOfflineSmall Offline

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.

Image Enlarger Image Enlarger

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>
&nbsp;||&nbsp;
<a href="#start" id="lnk_load">load</a>
&nbsp;||&nbsp;
<a href="#start" id="lnk_start">start</a>
&nbsp;||&nbsp;
<a href="#stop" id="lnk_stop">stop</a>
&nbsp;||&nbsp;
<a href="#remove" id="lnk_remove">remove</a>
</div>
<table id="list"></table>
<div id="pg"></div>
</div>
</body>
</html>

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

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

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.

02/03/2012
09:55
Avatar
caradees
Member
Members
Forum Posts: 8
Member Since:
28/02/2012
sp_UserOfflineSmall Offline

tony said:

Hello,

Which version of jQuery is used?

Can you please try with the last one.

Regards


Hi Tony,

Thank you for your reply. I am using the jQuery JavaScript Library v1.7.1

Regards

05/03/2012
15:48
Avatar
caradees
Member
Members
Forum Posts: 8
Member Since:
28/02/2012
sp_UserOfflineSmall Offline

@All visiting this thread

Forum Timezone: Europe/Sofia

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.com

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

Administrators: admin: 66

Comments are closed.
Privacy Policy   Terms and Conditions   Contact Information