Hi
I'm trying to understand some memory problems with my app and I need a basic understanding of how wingrid manages memory.
I have a button which executes a SQL query and returns a DataSet. The DataSet obviously owns an amount of memory
I then bind the DS to the grid using:
ultraGrid1.SetDataBinding( null, null ); ultraGrid1.SetDataBinding( oDS, null );
Q1: Does wingrid copy all of the data from the DataSet into the grid? Is my original DS unchanged?
Q2: If I press the button a 2nd time to repeat I will get a 2nd DataSet. Is my original DS still in memory? Does it go out of memory when ultraGrid1.SetDataBinding( null, null ); is called?
If I look at the app using Task Manager the memory just keeps going up until I get an out of memory exception
Thanks
That sounds like a bug to me. Can you post a small sample project demonstrating this so we can take a look?
So close! Having made those changes I can now refresh the screen as many times as I like. But if I apply some column filters (e.g. starts with 1) I can only refresh the screen 3 times before the app crashes.
With no column filters I can watch the app with the Task Manager as as the memory builds up I can see it decrease as the GC kicks in. It works consistently - the memory hovers around 1.2M
As soon as I use column filters the memory keeps going up and I never see it going down
Where should I look next?
Hi Dimitar
I removed the UI provider from my form and the app works fine. No more UltraGridColumns held in memory. I can refresh the grid as many times as I like. However, I need the Excel column filters facility, so this is what I've done (inside my LoadGrid() method):
UltraGridFilterUIProvider oColFilterUI = ultraGrid1.DisplayLayout.Override.FilterUIProvider; if (null != oColFilterUI) { oColFilterUI.Dispose(); } ultraGrid1.DisplayLayout.Override.FilterUIProvider = null;
oColFilterUI = new Infragistics.Win.SupportDialogs.FilterUIProvider.UltraGridFilterUIProvider(); ultraGrid1.DisplayLayout.Override.FilterUIProvider = oColFilterUI;
The UI provider is now not a form-level variable. Is there anything wrong with calling Dispose() on it each time I refresh the grid?
Hi,
Thank you for the reply.
I have modified the sample to use a filter UI provider and it still is working fine. Your caches might be what is holding on to the objects and not allowing the garbage collector to free the memory. What are you caching? Please make sure that nothing that you cache actually references the data set as this will definitely cause the memory leak. Also if you are caching the UltraGridLayout this might cause the grid columns to remain in memory. If you are able to reproduce this in my sample it will be really helpful for finding the root cause of your issue.
Thank you for your collaboration.
I am looking forward to hearing from you.
Thanks very much for the sample. I will keep playing with this until I can reproduce the behaviour that I am seeing with my app. If I can then I will get back to you. Apart from using lots of caches (generally HashTables) and having many different screens and cached layouts/DataSets, in principle the sample you have sent should allow me to do that.
I'm fairly certain that it relates to Excel filtering in some way. If I repeat the same search multiple times then I end up with an arbitrary number of DataSets left in memory and they are always being held there because of FilterUI objects
Thanks for your help