Release memory

Hi,
VS2003, 4.4.0.51

In your sample,
C:\Program Files\Syncfusion\Essential Studio\4.4.0.51\Windows\Grid.Grouping.Windows\Samples\PerformanceSamples\GroupingPerf\CS\GroupingPerf_2003.sln

The code releases memory used by the grid by dispose it, and recreate a new grid when next time reload.
void ResetGroupingGrid()
{
if (this.grid != null)
{
this.gridPanel.Controls.Remove(this.grid);
this.grid.Dispose();
this.grid = null;
this.table.Dispose();
this.table = null;
this.LogMemoryUsage1();
}
}



My questions is:
Is there any way to release the memory used by the grid without dispose and set it to null?
Because I have a form painted GGC at designed time. There are several buttons to reload the grid by different table data or by same table with different where condition.

Thanks,

Lan



1 Reply

SA Saravanan A Syncfusion Team October 11, 2007 03:11 AM UTC

Hi Lan,

You can try resetting the datasource of the grid and then reinitialize it instead of disposing the grid.


void ResetGroupingGrid()
{
if (this.grid != null)
{
//this.gridPanel.Controls.Remove(this.grid);
//this.grid.Dispose();
//this.grid = null;
if(this.grid.DataSource != null)
{
this.grid.DataSource = null;
this.grid.DataMember = "";
this.grid.Engine.Reset();
this.grid.Engine.ResetTableDescriptor();
this.grid.Engine.ResetTable();
}
this.table.Dispose();
this.table = null;
this.LogMemoryUsage();
}
}


Regards,
Saravanan

Loader.
Up arrow icon