Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
90
Ultragrid is not releasing used memory
posted

Hi,

I am using Ultragrid to load 80k records and found that after losding whole data grid takes 2GB of memory.

If we close this screen still this memory cann't released. 

Can you please guide us how can we reclaim this used memory.

Thanks,

Sunil

Parents
No Data
Reply
  • 21795
    Offline posted

    Hello Sunil,

    I have tested this behavior and you are correct. When the form is closed Garbage Collector does not collect some of the disposed object and used memory remains at the same level. What is interesting is that you can reproduce this behavior and with MS DataGridView. Therefore, I do not believe this is Infragistics specific issue. Attached is a small sample I’ve created to test this issue as well as a video I recorded during my test. As you can see form my sample GC collects at some point the disposed object, but it is .NET to decide when this will happen.

    What you can do to release the memory is dispose UltraGrid and force Garbage Collector to run. Nice place to do this is in form’s Disposed event. Dispose the grid and call Collect method of GC like this:

    private void FormWithUltraGrid_Disposed(object sender, EventArgs e)
    {
        if(this.ultraGrid1 != null && this.checkBoxDispose.Checked == true)
        {
            this.ultraGrid1.Dispose();
            GC.Collect();
        }
    }

    Again, even if you do not force the GC to collect disposed object it will do so at some point. However, when this will happen, as you know, is something .NET is taking care of.

    Thank you for using Infragistics Controls.

    UltraGridIssue.zip
Children
No Data