Hi,
Recently, one of my customer have experienced a memory leak because of the maximum GDI Objects that Windows XP accept; 10 000 before throwing a OutOfMemoryException.
I started searching in my framework and found a lot of leaks but not enough after many corrections.
I have created a small project with no dependencies except the framework of Microsoft and a couple of librairies of Infragistics to see if the problem can also be from Infragistics controls.
I have created a form with just one control; a UltraCombo.
This form is open as MdiChild of another form of type MdiParent.
When I open and close many times the MdiChild, the GDI Objects never stop to increase about 2 GDI Objects each time I close the form.
When I try with many controls of Microsoft like Textbox, Checkbox, label, etc... the number of GDI Objects always return to the original number.
Furthermore, when I click the dropdown button (And I have no datasource defined for the control), the GDI Objects grow from 20 and when I close the form, this number don't goes down.
As example, when I start the application, I have 54 GDI Objects. When I open the MdiChild, this number rises 72. If I close the form, the number goes down to 67. If I reopen again the MdiChild, the number of GDI Objects is now 74 and when I close it, it goes down 69. And it grow like that each time I open and close the form. If I open the drop down list, the number grow of increase of 10 and event if I close the form, the number of GDI Objects is now 86 (74 + 10 + 2)
My conclusion is that the UltraCombo have a memory leak. A small one but with many UltraCombo controls in the same form like in many of my real projects, this can be a problem if the user works many hours while opening and closing many forms that contains theses controls.
I don't try with UltraGrid and I will wait for your answer; recommandation...
Thank you.
Hello All,
Just to let you know that we include this fix in to the latest service release that it ready for download.
Let me know if you have any further questions.
Sincerely,DimiDeveloper Support EngineerInfragistics, Inc.
I have verified with the lastest version of service pack for Infragistics 2010 v.3 and all works perfectly now; there is no memory leak with the GDI Objects.
Thank you very much.
Hi, I'm also using Infragistics 2010 v.3 and still having memory leaks that can be easily reproducable by creating the following (I'm using VS.NET 2010):
Note: you don't have to set anything on the UltraCombo, just drop it on the form.
You'll notice that some GDI objects are never released. Is there other Infragistics controls that suffer from leaks? I'm able to produce leaks, with a low severity, with these other controls. The difference is that the leak is not additive that is the first time you open a form with these controls (and possibly others), you suffer from a small leak but after that, additionnal GDI objects seems to be released correctly:
Is there any workaround that we can use to free these GDI objects?
Thanks in advance
How exactly are you determining that there is a leak?
Since you mentioned GDI objects, I am guessing you are probably using Task Manager, but this is not an accurate tool for detecting leaks in a DotNet application. DotNet will allocate memory that gets cleaned up only when the GarbageCollector next performs a collection.
To accurately test for a leak, you need to force garbage collection and you should use a Memory Profiler specifically designed for DotNet such as Ants of SciTech.
Also, it's perfectly normal for some things to be loaded into memory and kept in memory for the life of the application. So the first time you show a form with an UltraCombo on it, it makes sense that memory usage would go up a little and stay up even after that form is closed.
I am attaching a sample here which is set up to test for memory leaks. What you would do is run this sample through a memory profiler. I happen to like Ants, so I used that.
The first thing I do is click the button to show one form. This loads the UltraCombo and it's dependent assemblies into memory. I then take a memory snapshot.
Then I click the second button which shows and hides 10 instances of the same form. Then I take another snapshot.
At this point Ants reports no increase in the number of instances of any classes between the two snapshots, so there is no leak there.