Hi, we have a fairly complicated system that is completely generated on the go.
The Grid is the main component and all columns, including template columns are created and populated on the fly.
I use ASP.NET Ajax package.
we have a mechanism that ignites an Ajax request every n seconds to refresh data in the grid.
We use a Telerik ajax panal for this.
Whenever the ajax call is received, the Ajax panel recreates the grid from the scratch and then the NeedDataSource event handler (Simply set the datasource of the grid to
PROBLEM : and the BROWSER memory keeps growing with each refresh until the browser crashes.
When I profiled the browser, I found that even though the browser fires GC it cannot recover memory.
Browser memory keeps increasing with every refresh and this is proportional to the record count of the grid.
I THINK THE OLD DATA OF THE GRID IS NOT RELEASED WHEN THE GRID IS REFRESHED.
This is the NeedDataSource event handler code. PLEASE REMEMBER THAT I RE-CREATE THE GRID AT REFRESH
protected void RadGrid1_NeedDataSource(object sender, Telerik.Web.UI.GridNeedDataSourceEventArgs e)
{
Telerik.Web.UI.RadGrid tmpPointerToUIGrid = sender as Telerik.Web.UI.RadGrid;
// override default grid page size at the initial run. (the custom paging is not in effect at this stage)
if (ssession.DVM.CurrentRequestType != REQUEST_TYPE.DATA_REFRESH && e.RebindReason == GridRebindReason.InitialLoad)
{
tmpPointerToUIGrid.PageSize = SymphonySession.FindObject(HttpContext.Current.Session).InitialiseResponse.PageSize.Options.Find(op => op.IsDefault == 1).Value;
}
if (ssession.DVM.CurrentRequestType != REQUEST_TYPE.DATA_REFRESH && string.IsNullOrEmpty(tmpPointerToUIGrid.MasterTableView.FilterExpression) && this.Model.FilterCriteria != null && this.Model.FilterCriteria.Count > 0)
{ this.Model.FilterCriteria.Clear(); } // clear filters when no filter is selectered.
ssession.Trace_addStamp("processing data for grid");
tmpPointerToUIGrid.DataSource = this.Model.GetDataSource((e.RebindReason == GridRebindReason.InitialLoad) && ssession.DVM.CurrentRequestType != REQUEST_TYPE.DATA_REFRESH, tmpPointerToUIGrid.PageSize, tmpPointerToUIGrid.CurrentPageIndex + 1);
tmpPointerToUIGrid.MasterTableView.VirtualItemCount = this.Model.GridTotalRowCount;
ssession.Trace_addStamp("done: data processing");
if (ssession.DVM.CurrentRequestType != REQUEST_TYPE.DATA_REFRESH)
{
this.Model.GridFilterExpression = this.RadGrid1.MasterTableView.FilterExpression; // save for future refresh commands
}
}
Please help...
The Grid is the main component and all columns, including template columns are created and populated on the fly.
I use ASP.NET Ajax package.
we have a mechanism that ignites an Ajax request every n seconds to refresh data in the grid.
We use a Telerik ajax panal for this.
Whenever the ajax call is received, the Ajax panel recreates the grid from the scratch and then the NeedDataSource event handler (Simply set the datasource of the grid to
PROBLEM : and the BROWSER memory keeps growing with each refresh until the browser crashes.
When I profiled the browser, I found that even though the browser fires GC it cannot recover memory.
Browser memory keeps increasing with every refresh and this is proportional to the record count of the grid.
I THINK THE OLD DATA OF THE GRID IS NOT RELEASED WHEN THE GRID IS REFRESHED.
This is the NeedDataSource event handler code. PLEASE REMEMBER THAT I RE-CREATE THE GRID AT REFRESH
protected void RadGrid1_NeedDataSource(object sender, Telerik.Web.UI.GridNeedDataSourceEventArgs e)
{
Telerik.Web.UI.RadGrid tmpPointerToUIGrid = sender as Telerik.Web.UI.RadGrid;
// override default grid page size at the initial run. (the custom paging is not in effect at this stage)
if (ssession.DVM.CurrentRequestType != REQUEST_TYPE.DATA_REFRESH && e.RebindReason == GridRebindReason.InitialLoad)
{
tmpPointerToUIGrid.PageSize = SymphonySession.FindObject(HttpContext.Current.Session).InitialiseResponse.PageSize.Options.Find(op => op.IsDefault == 1).Value;
}
if (ssession.DVM.CurrentRequestType != REQUEST_TYPE.DATA_REFRESH && string.IsNullOrEmpty(tmpPointerToUIGrid.MasterTableView.FilterExpression) && this.Model.FilterCriteria != null && this.Model.FilterCriteria.Count > 0)
{ this.Model.FilterCriteria.Clear(); } // clear filters when no filter is selectered.
ssession.Trace_addStamp("processing data for grid");
tmpPointerToUIGrid.DataSource = this.Model.GetDataSource((e.RebindReason == GridRebindReason.InitialLoad) && ssession.DVM.CurrentRequestType != REQUEST_TYPE.DATA_REFRESH, tmpPointerToUIGrid.PageSize, tmpPointerToUIGrid.CurrentPageIndex + 1);
tmpPointerToUIGrid.MasterTableView.VirtualItemCount = this.Model.GridTotalRowCount;
ssession.Trace_addStamp("done: data processing");
if (ssession.DVM.CurrentRequestType != REQUEST_TYPE.DATA_REFRESH)
{
this.Model.GridFilterExpression = this.RadGrid1.MasterTableView.FilterExpression; // save for future refresh commands
}
}
Please help...